From fbcf8c97d90d3eada71c270a43383b35efc16ed5 Mon Sep 17 00:00:00 2001 From: atrakic Date: Wed, 10 Jul 2024 13:05:41 +0200 Subject: [PATCH] Fix gh-actions --- .github/workflows/call-docker-build-web.yaml | 43 ++++++++++---------- .github/workflows/test.yml | 6 +-- pytest.ini | 2 +- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/call-docker-build-web.yaml b/.github/workflows/call-docker-build-web.yaml index 0c34577..bf741c6 100644 --- a/.github/workflows/call-docker-build-web.yaml +++ b/.github/workflows/call-docker-build-web.yaml @@ -1,28 +1,20 @@ name: Build Web -# template source: https://github.com/dockersamples/.github/blob/main/templates/call-docker-build.yaml on: - # we want pull requests so we can build(test) but not push to image registry push: - branches: - - 'main' - # only build when important files change - paths: - - 'src/**' - - '.github/workflows/call-docker-build-web.yaml' - pull_request: - branches: - - 'main' - # only build when important files change - paths: - - 'src/**' - - '.github/workflows/call-docker-build-web.yaml' + tags: + - '*' + workflow_dispatch: + workflow_run: + workflows: ["Test"] + types: [completed] jobs: - call-docker-build: - - name: Web Call Docker Build + docker-build: + name: Docker Build uses: dockersamples/.github/.github/workflows/reusable-docker-build.yaml@main + if: ${{ github.event.workflow_run.conclusion == 'success' }} && + ${{ github.event.workflow_run.head_branch == 'main' }} permissions: contents: read @@ -38,7 +30,6 @@ jobs: dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} with: - ### REQUIRED ### ENABLE ONE OR BOTH REGISTRIES ### tell docker where to push. @@ -56,12 +47,16 @@ jobs: ### https://github.com/docker/metadata-action#tags-input ### defaults to: tag-rules: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} + type=raw,value=latest,enable={{is_default_branch}} type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha ### path to where docker should copy files into image ### defaults to root of repository (.) - context: ./src + # context: . ### Dockerfile alternate name. Default is Dockerfile (relative to context path) # file: Containerfile @@ -76,3 +71,9 @@ jobs: ### Create a PR comment with image tags and labels ### defaults to false # comment-enable: false + +## Example release pipeline trigger: +# +# TAG="v0.0.1" +# git tag "$TAG" -m "Release version: $TAG" +# git push origin --tags diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4e5765..597c637 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,8 +27,8 @@ jobs: run: | python -m pip install --upgrade pip pip install pylint pytest flake8 - pip install -r ./src/requirements.txt - + pip install -r ./requirements.txt + - name: Analysing the code with pylint run: | pylint $(git ls-files '*.py') @@ -39,4 +39,4 @@ jobs: - name: Running the tests run: | - pytest -v \ No newline at end of file + pytest -v diff --git a/pytest.ini b/pytest.ini index f40e9f7..e4c7a44 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,4 @@ [pytest] ; log_cli=true ; log_level=INFO -addopts = -p no:warnings \ No newline at end of file +addopts = -p no:warnings