From cf1b5ba699766fa69d7c12f719ca2185c5c9ff5d Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 24 Oct 2021 11:53:14 +1300 Subject: [PATCH 1/5] Create build-docker.yml --- .github/workflows/build-docker.yml | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/build-docker.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..580e4882 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,52 @@ +name: Build and Publish + +on: + # run it on push to the default repository branch + push: + branches: [master,deploy/release,deploy/force-release] + # run it during pull request + pull_request: + +defaults: + # define job to build and publish docker image + build-and-push-docker-image: + name: Build Docker image and push to repositories + # run only when code is compiling and tests are passing + runs-on: ubuntu-latest + + # steps to perform in job + steps: + - name: Checkout code + uses: actions/checkout@v2 + + # setup Docker buld action + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to Github Packages + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_PAT }} + + - name: Build image and push to Docker Hub and GitHub Container Registry + uses: docker/build-push-action@v2 + with: + # relative path to the place where source code with Dockerfile is located + context: ./src/samples/simple + # Note: tags has to be all lower-case + tags: | + jaedb/iris:master + # build on feature branches, push only on master branch + push: ${{ github.ref == 'refs/heads/master' }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} From ae3412b3c33ba7ad1330afc60aeea5f59124f6b8 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 24 Oct 2021 11:57:08 +1300 Subject: [PATCH 2/5] Update build-docker.yml --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 580e4882..e904ca1d 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -7,7 +7,7 @@ on: # run it during pull request pull_request: -defaults: +jobs: # define job to build and publish docker image build-and-push-docker-image: name: Build Docker image and push to repositories From fe500b80f5e9d8b10f3b0edb06c920b26c5ed366 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 24 Oct 2021 11:58:26 +1300 Subject: [PATCH 3/5] Defining context --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index e904ca1d..3a9cf059 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -41,7 +41,7 @@ jobs: uses: docker/build-push-action@v2 with: # relative path to the place where source code with Dockerfile is located - context: ./src/samples/simple + context: . # Note: tags has to be all lower-case tags: | jaedb/iris:master From 6571595fcafae9ced34b97ebab4e1d577a2b58d7 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 24 Oct 2021 12:09:34 +1300 Subject: [PATCH 4/5] Update build-docker.yml --- .github/workflows/build-docker.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 3a9cf059..dd864ca3 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -1,25 +1,18 @@ -name: Build and Publish +name: Build Docker on: - # run it on push to the default repository branch push: branches: [master,deploy/release,deploy/force-release] - # run it during pull request - pull_request: jobs: - # define job to build and publish docker image build-and-push-docker-image: - name: Build Docker image and push to repositories - # run only when code is compiling and tests are passing + name: Build image and push to DockerHub runs-on: ubuntu-latest - # steps to perform in job steps: - name: Checkout code uses: actions/checkout@v2 - - # setup Docker buld action + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 @@ -40,9 +33,7 @@ jobs: - name: Build image and push to Docker Hub and GitHub Container Registry uses: docker/build-push-action@v2 with: - # relative path to the place where source code with Dockerfile is located context: . - # Note: tags has to be all lower-case tags: | jaedb/iris:master # build on feature branches, push only on master branch From a7e9308f43198f086c5d1166419b294da3321405 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 24 Oct 2021 12:14:49 +1300 Subject: [PATCH 5/5] Create python-tests.yml --- .github/workflows/python-tests.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/python-tests.yml diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 00000000..ccef1bc6 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,25 @@ +name: Python tests + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox