From dea2b409ca17d3be9b5dca58cb2ee95947bd3e31 Mon Sep 17 00:00:00 2001 From: "Jessica S. Yu" <15913767+jessicasyu@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:18:55 -0400 Subject: [PATCH] Update workflow action versions and badges (#61) * Bump actions/checkout to v4 * Bump actions/setup-python to v5 * Bump actions/cache to v4 * Bump mikepenz/release-changelog-builder-action to v4 * Rename cache action * Update workflows to only create badges on main --- .github/workflows/build.yml | 18 +++++++-------- .github/workflows/documentation.yml | 14 ++++++------ .github/workflows/lint.yml | 34 +++++++++++++++++++++++------ .github/workflows/publish.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33aded2..f416425 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,10 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -26,15 +26,15 @@ jobs: virtualenvs-create: true virtualenvs-in-project: true - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 + - name: Cache environment + id: cached-dependencies + uses: actions/cache@v4 with: path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + if: steps.cached-dependencies.outputs.cache-hit != 'true' run: | poetry install --no-interaction --no-root @@ -83,7 +83,7 @@ jobs: clean: false result: - if: ${{ always() }} + if: ${{ always() && github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest @@ -92,7 +92,7 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get build result run: | diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 6a9fd72..d2e7be8 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -12,10 +12,10 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 @@ -25,15 +25,15 @@ jobs: virtualenvs-create: true virtualenvs-in-project: true - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 + - name: Cache environment + id: cached-dependencies + uses: actions/cache@v4 with: path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + if: steps.cached-dependencies.outputs.cache-hit != 'true' run: | poetry install --no-interaction --no-root diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a99ae83..b4eac0f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,10 +9,10 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 @@ -22,15 +22,15 @@ jobs: virtualenvs-create: true virtualenvs-in-project: true - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 + - name: Cache environment + id: cached-dependencies + uses: actions/cache@v4 with: path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + if: steps.cached-dependencies.outputs.cache-hit != 'true' run: | poetry install --no-interaction --no-root @@ -54,6 +54,26 @@ jobs: source .venv/bin/activate mypy src + result: + if: ${{ always() && github.ref == 'refs/heads/main' }} + + runs-on: ubuntu-latest + + needs: [lint] + + steps: + + - name: Checkout the repo + uses: actions/checkout@v4 + + - name: Get lint result + run: | + if [[ ${{ needs.lint.result }} == "success" || ${{ needs.lint.result }} == "skipped" ]]; then + exit 0 + else + exit 1 + fi + - name: Generate passing badge if: success() uses: knightdave/anybadge-action@v1.1.0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3db7699..18c7652 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Extract version from branch name run: | @@ -72,7 +72,7 @@ jobs: body: ${{ steps.build_changelog.outputs.changelog }} - name: Set up Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2309082..34bb126 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Extract version from branch name run: | @@ -45,7 +45,7 @@ jobs: - name: Build changelog id: build_changelog - uses: mikepenz/release-changelog-builder-action@v3.4.0 + uses: mikepenz/release-changelog-builder-action@v4 with: configurationJson: | {