-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Replace install steps by composite actions (#2146)
Fixes: #2107 Canary build is failed because storybook requires node 16. Composite action `install` already updated to use node 16. After refactoring `release` and `minor-release` actions, we can replace hard-coded install steps (caching and packages install) by calling the composite action. It allows cleaning repeated steps to increase code readability and to make action maintenance easier in situations like this failure. [category:Infrastructure]
- Loading branch information
1 parent
8d562b6
commit 6e88317
Showing
3 changed files
with
32 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ on: | |
- prerelease/* | ||
workflow_dispatch: # Allow manual triggering of this job in case of failures | ||
|
||
|
||
jobs: | ||
canary: | ||
runs-on: ubuntu-latest | ||
|
@@ -15,49 +14,14 @@ jobs: | |
## First, we'll checkout the repository. We don't persist credentials because we need a | ||
## Personal Access Token to push on a branch that is protected. See | ||
## https://github.com/cycjimmy/semantic-release-action#basic-usage | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 0 # Used for conventional commit ranges | ||
|
||
- name: Get Cypress Version | ||
id: cypress-version | ||
run: echo "::set-output name=version::$(node utils/get-cypress-version.js)" | ||
|
||
## This step installs node and sets up several matchers (regex matching for Github | ||
## Annotations). See | ||
## https://github.com/actions/setup-node/blob/25316bbc1f10ac9d8798711f44914b1cf3c4e954/src/main.ts#L58-L65 | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 14.x | ||
registry-url: https://registry.npmjs.org | ||
|
||
## The caching steps create a cache key based on the OS and hash of the yarn.lock file. A | ||
## cache hit will copy files from Github cache into the `node_modules` and `.cache/cypress` | ||
## folders. A cache hit will skip the cache steps | ||
- name: Cache node modules | ||
id: yarn-cache | ||
uses: actions/cache@v1 | ||
- uses: Workday/canvas-kit-actions/install@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Cache Cypress | ||
id: cypress-cache | ||
uses: actions/cache/@v1 | ||
with: | ||
path: .cache/cypress | ||
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} | ||
|
||
## If both `node_modules` and `.cache/cypress` were cache hits, we're going to skip the `yarn | ||
## install` step. This effectively saves up to 3m on a cache hit build. | ||
- name: Install Packages | ||
if: | ||
steps.yarn-cache.outputs.cache-hit != 'true' || steps.cypress-cache.outputs.cache-hit != | ||
'true' | ||
run: yarn install --production=false | ||
env: | ||
CYPRESS_CACHE_FOLDER: .cache/cypress | ||
node_version: 16.x | ||
|
||
## Build Storybook and extract component stories for Storybook aggregation. This will be used | ||
## for Chromatic rebaselining and publishing to GH Pages. Should be before `yarn build` since | ||
|
@@ -77,14 +41,15 @@ jobs: | |
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_CI_PUBLISH_TOKEN}} | ||
SLACK_WEBHOOK: ${{secrets.SLACK_WEBHOOK}} | ||
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
BUILD_URL: | ||
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
|
||
## Create a Chromatic baseline auto-accepting changes. Chromatic changes are already accepted | ||
## in PRs, so we don't need to manually approve them here again. This new baseline will be | ||
## used for future PRs. New PRs may show extra Chromatic changes until the "Update Branch" | ||
## button is used in PRs which will pull this new baseline. | ||
- name: Update Chromatic Baseline | ||
uses: chromaui/action@v1 | ||
uses: chromaui/action@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
projectToken: ${{ secrets.CHROMATIC_APP_CODE }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,18 +19,20 @@ jobs: | |
# the release workflow will commit a release commit starting with `chore: Release ...` back to | ||
# the branch and this job will run on that commit instead. Also, forward merges that skipped | ||
# a release | ||
if: "((github.ref_name == 'support' || github.ref_name == 'master') && startsWith(github.event.head_commit.message, 'chore: Release')) || startsWith(github.ref_name, 'prerelease/') || contains(github.event.head_commit.message, '[skip release]')" | ||
if: | ||
"((github.ref_name == 'support' || github.ref_name == 'master') && | ||
startsWith(github.event.head_commit.message, 'chore: Release')) || startsWith(github.ref_name, | ||
'prerelease/') || contains(github.event.head_commit.message, '[skip release]')" | ||
runs-on: ubuntu-latest | ||
outputs: # Output branch names for the make-pull-request job | ||
branch: ${{steps.extract-branch.outputs.branch}} | ||
next-branch: ${{steps.extract-next-branch.outputs.branch}} | ||
|
||
steps: | ||
|
||
## First, we'll checkout the repository. We don't persist credentials because we need a | ||
## Personal Access Token to push on a branch that is protected. See | ||
## https://github.com/cycjimmy/semantic-release-action#basic-usage | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 0 # Needed to do merges | ||
|
@@ -49,44 +51,9 @@ jobs: | |
echo "::set-output name=branch::$(node utils/get-forward-merge-branch.js)" | ||
echo ${{steps.extract-next-branch.outputs.branch}} | ||
## This step installs node and sets up several matchers (regex matching for Github | ||
## Annotations). See | ||
## https://github.com/actions/setup-node/blob/25316bbc1f10ac9d8798711f44914b1cf3c4e954/src/main.ts#L58-L65 | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 14.x | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Get Cypress Version | ||
id: cypress-version | ||
run: echo "::set-output name=version::$(node utils/get-cypress-version.js)" | ||
|
||
## The caching steps create a cache key based on the OS and hash of the yarn.lock file. A | ||
## cache hit will copy files from Github cache into the `node_modules` and `.cache/cypress` | ||
## folders. A cache hit will skip the cache steps | ||
- name: Cache node modules | ||
id: yarn-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Cache Cypress | ||
id: cypress-cache | ||
uses: actions/cache/@v2 | ||
- uses: Workday/canvas-kit-actions/install@v1 | ||
with: | ||
path: .cache/cypress | ||
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} | ||
|
||
## If both `node_modules` and `.cache/cypress` were cache hits, we're going to skip the `yarn | ||
## install` step. This effectively saves up to 3m on a cache hit build. | ||
- name: Install Packages | ||
if: | ||
steps.yarn-cache.outputs.cache-hit != 'true' || steps.cypress-cache.outputs.cache-hit != | ||
'true' | ||
run: yarn install --production=false | ||
env: | ||
CYPRESS_CACHE_FOLDER: .cache/cypress | ||
node_version: 16.x | ||
|
||
## A `yarn bump` will create a commit and a tag. We need to set up the git user to do this. | ||
## We'll make that user be the github-actions user. | ||
|
@@ -127,7 +94,7 @@ jobs: | |
key: ${{ runner.os }}-build-${{ github.sha }} | ||
|
||
- name: Visual Tests | ||
uses: chromaui/action@v1 | ||
uses: chromaui/action@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
appCode: dlpro96xybh | ||
|
@@ -213,4 +180,3 @@ jobs: | |
You must then force-push the branch and the CI will rerun verification. | ||
Use the `automerge` label like normal and the CI will pick the correct merge strategy. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters