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 9b09c0c commit 817f401
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 7 deletions.
33 changes: 27 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: ftps:test

jobs:
test:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v4
build:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -41,6 +38,28 @@ 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:
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 @@ -54,6 +73,8 @@ jobs:
tags: |
bfren/ftps:dev
bfren/ftps:${{ steps.version.outputs.contents }}-dev
ghcr.io/bfren/ftps:dev
ghcr.io/bfren/ftps:${{ steps.version.outputs.contents }}-dev
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,21 @@ 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
uses: docker/build-push-action@v5
with:
build-args: |
BF_IMAGE=${{ env.REPOSITORY_NAME }}
BF_PUBLISHING=1
BF_VERSION=${{ steps.version.outputs.contents }}
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64
Expand All @@ -85,6 +93,16 @@ jobs:
bfren/ftps:vsftpd${{ steps.vsftpd_minor.outputs.contents }}-${{ steps.version.outputs.contents }}
bfren/ftps:vsftpd${{ steps.vsftpd_revision.outputs.contents }}
bfren/ftps:vsftpd${{ steps.vsftpd_revision.outputs.contents }}-${{ steps.version.outputs.contents }}
ghcr.io/bfren/ftps:latest
ghcr.io/bfren/ftps:${{ steps.version_major.outputs.contents }}
ghcr.io/bfren/ftps:${{ steps.version_minor.outputs.contents }}
ghcr.io/bfren/ftps:${{ steps.version.outputs.contents }}
ghcr.io/bfren/ftps:vsftpd${{ steps.vsftpd_major.outputs.contents }}
ghcr.io/bfren/ftps:vsftpd${{ steps.vsftpd_major.outputs.contents }}-${{ steps.version.outputs.contents }}
ghcr.io/bfren/ftps:vsftpd${{ steps.vsftpd_minor.outputs.contents }}
ghcr.io/bfren/ftps:vsftpd${{ steps.vsftpd_minor.outputs.contents }}-${{ steps.version.outputs.contents }}
ghcr.io/bfren/ftps:vsftpd${{ steps.vsftpd_revision.outputs.contents }}
ghcr.io/bfren/ftps:vsftpd${{ steps.vsftpd_revision.outputs.contents }}-${{ 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
15 changes: 15 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

IMAGE=ftps
VERSION=`cat VERSION`
TAG=${IMAGE}-test

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

0 comments on commit 817f401

Please sign in to comment.