From 4fc79cf777ac455642bc0ef5c754df51ff7f9b60 Mon Sep 17 00:00:00 2001 From: Paul Schultz Date: Tue, 3 Dec 2024 12:50:47 -0600 Subject: [PATCH] chore: update workflows to use cache and --continue flag (#2584) Signed-off-by: Paul Schultz --- .github/actions/build/action.yaml | 28 ++++++++++---------- .github/actions/test/action.yaml | 6 ++--- .github/actions/yarn-lock/action.yaml | 35 ------------------------- .github/workflows/pr.yaml | 20 +++++++------- .github/workflows/release.yaml | 6 ++--- .github/workflows/update-backstage.yaml | 4 ++- 6 files changed, 33 insertions(+), 66 deletions(-) delete mode 100644 .github/actions/yarn-lock/action.yaml diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 207b45851f..486fc300d1 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -1,14 +1,14 @@ -name: Build packages -description: Build packages -inputs: - args: - description: Backstage CLI repo build arguments - default: --filter=@janus-idp/* - -runs: - using: 'composite' - steps: - - name: Build packages - shell: bash - run: | - yarn run build --concurrency=75% ${{ inputs.args }} +name: Build packages +description: Build packages +inputs: + args: + description: Backstage CLI repo build arguments + default: --filter=@janus-idp/* + +runs: + using: 'composite' + steps: + - name: Build packages + shell: bash + run: | + yarn run build --continue ${{ inputs.args }} diff --git a/.github/actions/test/action.yaml b/.github/actions/test/action.yaml index 2c951011be..9995030fe9 100644 --- a/.github/actions/test/action.yaml +++ b/.github/actions/test/action.yaml @@ -10,12 +10,12 @@ runs: steps: - name: Run prettier shell: bash - run: yarn prettier:check --concurrency=75% ${{ inputs.args }} + run: yarn prettier:check --continue ${{ inputs.args }} - name: Run lint shell: bash - run: yarn run lint:check --concurrency=75% ${{ inputs.args }} + run: yarn run lint:check --continue ${{ inputs.args }} - name: Run tests shell: bash - run: yarn run test --concurrency=75% ${{ inputs.args }} + run: yarn run test --continue ${{ inputs.args }} diff --git a/.github/actions/yarn-lock/action.yaml b/.github/actions/yarn-lock/action.yaml deleted file mode 100644 index ecf69fd22c..0000000000 --- a/.github/actions/yarn-lock/action.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Regen yarn.lock -description: Regenerate yarn.lock -runs: - using: 'composite' - steps: - - name: Create PR if yarn.lock has changed - shell: bash - run: | - changed_files="$(git diff --name-only . || true)" - if [[ $changed_files ]]; then - echo "After 'yarn install', workspace is dirty! The following files have changed:" - echo - echo "$changed_files" - echo - git config --global user.name "RHDH Bot" - git config --global user.email rhdh-bot@redhat.com - git config --global pull.rebase true - git config --global push.default matching - - git stash || true - CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - PR_BRANCH="ci-regen-yarn-lock-$(date +%s)" - git branch "${PR_BRANCH}" - git checkout "${PR_BRANCH}" - git pull origin "${PR_BRANCH}" || true - - git stash pop || true - git add yarn.lock || true - git commit -s -m "chore(deps): regen yarn.lock" yarn.lock || true - export GITHUB_TOKEN="${GITHUB_TOKEN}" - set -x - echo "$(git config user.name) <$(git config user.email)>"; echo; gh auth status - git push origin "${PR_BRANCH}" - gh pr create -B "${CURRENT_BRANCH}" -H "${PR_BRANCH}" --title "chore(deps): regen yarn.lock" --body "Created by Github action due to dirty workspace." - fi diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 65b156f63d..2229393ec3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -30,14 +30,14 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - name: Setup local Turbo cache uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1 - name: Install dependencies - run: | - yarn install + uses: backstage/actions/yarn-install@25145dd4117d50e1da9330e9ed2893bc6b75373e # v0.6.15 + with: + cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }} - name: Build packages uses: ./.github/actions/build @@ -61,14 +61,14 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - name: Setup local Turbo cache uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1 - name: Install dependencies - run: | - yarn install + uses: backstage/actions/yarn-install@25145dd4117d50e1da9330e9ed2893bc6b75373e # v0.6.15 + with: + cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }} - name: Verify changesets if: ${{ !(github.actor == 'janus-idp[bot]' || github.actor == 'github-actions[bot]') }} @@ -97,14 +97,14 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - name: Setup local Turbo cache uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1 - name: Install dependencies - run: | - yarn install + uses: backstage/actions/yarn-install@25145dd4117d50e1da9330e9ed2893bc6b75373e # v0.6.15 + with: + cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }} - name: Install playwright run: npx playwright install --with-deps chromium @@ -114,7 +114,7 @@ jobs: # enable permission support and RBAC plugins printf "\npermission:\n enabled: true\n" >> $(pwd)/app-config.yaml - yarn run ui-test --affected + yarn run ui-test --affected --continue - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4 if: ${{ !cancelled() }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7d7e1f4776..9e259c3c94 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -41,9 +41,9 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install dependencies - shell: bash - run: | - yarn install + uses: backstage/actions/yarn-install@25145dd4117d50e1da9330e9ed2893bc6b75373e # v0.6.15 + with: + cache-prefix: ${{ runner.os }}-v20 - name: Creating .npmrc run: | diff --git a/.github/workflows/update-backstage.yaml b/.github/workflows/update-backstage.yaml index 06c549247e..b75b8a4544 100644 --- a/.github/workflows/update-backstage.yaml +++ b/.github/workflows/update-backstage.yaml @@ -60,7 +60,9 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install dependencies - run: yarn install + uses: backstage/actions/yarn-install@25145dd4117d50e1da9330e9ed2893bc6b75373e # v0.6.15 + with: + cache-prefix: ${{ runner.os }}-v20 - name: Run versons:bump script run: |