Skip to content

Commit

Permalink
Adding new test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
bfren committed Feb 23, 2024
1 parent 5a2d5a3 commit f06b099
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 7 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ on:
tags-ignore: ['**']
workflow_dispatch:

env:
TEST_TAG: clamav:test

jobs:
test:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v4
build:
strategy:
fail-fast: false
Expand Down Expand Up @@ -45,6 +42,29 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and export
id: docker_export
uses: docker/build-push-action@v5
with:
file: ./${{ matrix.clamav }}/Dockerfile
build-args: |
BF_IMAGE=${{ env.REPOSITORY_NAME }}
BF_VERSION=${{ steps.version.outputs.contents }}
load: true
tags: ${{ env.TEST_TAG }}
-
name: Run tests
id: docker_test
run: |
docker run --entrypoint "/usr/bin/env" ${{ env.TEST_TAG }} -i nu -c "use bf test ; test"
-
name: Build and push
id: docker_build
Expand All @@ -60,6 +80,8 @@ jobs:
tags: |
bfren/clamav:clamav${{ matrix.clamav }}-dev
bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version.outputs.contents }}-dev
ghcr.io/bfren/clamav:clamav${{ matrix.clamav }}-dev
ghcr.io/bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version.outputs.contents }}-dev
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
id: docker_build
Expand All @@ -75,6 +82,11 @@ jobs:
bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version_minor.outputs.contents }}
bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version.outputs.contents }}
bfren/clamav:clamav${{ steps.clamav_revision.outputs.contents }}
ghcr.io/bfren/clamav:clamav${{ matrix.clamav }}
ghcr.io/bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version_major.outputs.contents }}
ghcr.io/bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version_minor.outputs.contents }}
ghcr.io/bfren/clamav:clamav${{ matrix.clamav }}-${{ steps.version.outputs.contents }}
ghcr.io/bfren/clamav:clamav${{ steps.clamav_revision.outputs.contents }}
-
name: Build and push default tags
id: docker_build_default
Expand All @@ -94,6 +106,10 @@ jobs:
bfren/clamav:${{ steps.version_major.outputs.contents }}
bfren/clamav:${{ steps.version_minor.outputs.contents }}
bfren/clamav:${{ steps.version.outputs.contents }}
ghcr.io/bfren/clamav:latest
ghcr.io/bfren/clamav:${{ steps.version_major.outputs.contents }}
ghcr.io/bfren/clamav:${{ steps.version_minor.outputs.contents }}
ghcr.io/bfren/clamav:${{ steps.version.outputs.contents }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Empty file.
2 changes: 1 addition & 1 deletion pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ -n "${1-}" ] ; then
git checkout ${1} && git pull
fi

chmod +x pull.sh run.sh
chmod +x pull.sh run.sh test.sh
16 changes: 16 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

IMAGE=clamav
VERSION=`cat VERSION`
CLAMAV=${1:-1.2}
TAG=${IMAGE}-test

docker buildx build \
--load \
--build-arg BF_IMAGE=${IMAGE} \
--build-arg BF_VERSION=${VERSION} \
-f ${CLAMAV}/Dockerfile \
-t ${TAG} \
. \
&& \
docker run --entrypoint "/usr/bin/env" ${TAG} -i nu -c "use bf test ; test"

0 comments on commit f06b099

Please sign in to comment.