From b312694f6cbfc8fa1dd6c6bc24618b4e7af7a13d Mon Sep 17 00:00:00 2001 From: Infrastructure Robot Date: Wed, 5 Mar 2025 00:15:15 +0100 Subject: [PATCH 1/2] Add concurrency to workflows --- .github/workflows/pages.yml | 10 +++++++--- .github/workflows/publish_pypi.yml | 10 +++++++--- .github/workflows/test.yml | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 830dca4..0144461 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,8 +4,12 @@ name: Deploy static content to Pages on: push: branches: - - master + - master - main + +concurrency: + group: ${{ github.workflow }}${{ github.ref_name != github.event.repository.default_branch && github.ref || github.run_id }} + cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }} permissions: contents: write jobs: @@ -20,7 +24,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - uses: actions/cache@v4 with: key: mkdocs-material-${{ env.cache_id }} @@ -28,4 +32,4 @@ jobs: restore-keys: | mkdocs-material- - run: pip install mkdocs mkdocstrings[python] mkdocs-material - - run: mkdocs gh-deploy --force \ No newline at end of file + - run: mkdocs gh-deploy --force diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 9acf204..10d32b7 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -2,7 +2,11 @@ name: Publish python poetry package on: # Triggers the workflow on push or pull request events but only for the "main" branch push: - branches: [ "main" ] + branches: ["main"] + +concurrency: + group: ${{ github.workflow }}${{ github.ref_name != github.event.repository.default_branch && github.ref || github.run_id }} + cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }} jobs: build: @@ -13,9 +17,9 @@ jobs: shell: bash env: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: | + run: |- pip install poetry poetry config virtualenvs.create false poetry build echo "Publishing now..." - poetry publish -u "__token__" --password "$PYPI_TOKEN" || true \ No newline at end of file + poetry publish -u "__token__" --password "$PYPI_TOKEN" || true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a3d393b..ab8b2f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,13 +6,17 @@ name: Tests on: # Triggers the workflow on push or pull request events but only for the "main" branch push: - branches: [ "main", "master" ] + branches: ["main", "master"] pull_request: - branches: [ "main", "master" ] + branches: ["main", "master"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +concurrency: + group: ${{ github.workflow }}${{ github.ref_name != github.event.repository.default_branch && github.ref || github.run_id }} + cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }} + jobs: test: # The type of runner that the job will run on @@ -25,7 +29,7 @@ jobs: # Runs a single command using the runners shell - name: Install dependencies - run: | + run: | sudo apt update -y sudo apt install gnome-keyring pip install --upgrade pip From fa1e226532382c23ee39f2a6ef914faa805e5808 Mon Sep 17 00:00:00 2001 From: Lidija Coha Date: Tue, 18 Mar 2025 14:49:32 +0100 Subject: [PATCH 2/2] Fix indentation in publish_pypi.yml script --- .github/workflows/publish_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 10d32b7..fbfed60 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -17,7 +17,7 @@ jobs: shell: bash env: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: |- + run: | pip install poetry poetry config virtualenvs.create false poetry build