-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: migrate from CircleCI to Github Actions (#1836)
- Loading branch information
Showing
7 changed files
with
4,773 additions
and
5,458 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 |
---|---|---|
|
@@ -2,73 +2,10 @@ version: 2.1 | |
orbs: | ||
node: circleci/[email protected] | ||
|
||
references: | ||
executor: &executor | ||
jobs: | ||
build: | ||
executor: | ||
name: node/default | ||
tag: lts | ||
|
||
workspace_root: &workspace_root ~/project | ||
|
||
attach_workspace: &attach_workspace | ||
attach_workspace: | ||
at: *workspace_root | ||
|
||
persist_to_workspace: &persist_to_workspace | ||
persist_to_workspace: | ||
root: *workspace_root | ||
paths: . | ||
|
||
jobs: | ||
build: | ||
<<: *executor | ||
steps: | ||
- checkout | ||
- node/install-packages: | ||
override-ci-command: npm ci --ignore-scripts | ||
cache-version: '{{ .Environment.CACHE_VERSION }}' | ||
- run: npm exec -- lerna run build --concurrency=2 # prevent out-of-memory | ||
- *persist_to_workspace | ||
|
||
test: | ||
<<: *executor | ||
steps: | ||
- *attach_workspace | ||
- run: npm run test:ci -- --runInBand | ||
- run: '[ $COVERALLS_REPO_TOKEN ] && npm exec -- coveralls < .cache/coverage/lcov.info || true' | ||
- *persist_to_workspace | ||
|
||
deploy: | ||
<<: *executor | ||
environment: | ||
NODE_DEBUG: gh-pages | ||
steps: | ||
- *attach_workspace | ||
- run: npm run build:demo | ||
- run: utils/scripts/deploy.mjs | ||
|
||
publish: | ||
<<: *executor | ||
steps: | ||
- *attach_workspace | ||
- run: npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN | ||
- run: npm exec -- lerna publish from-git --ignore-scripts --yes | ||
|
||
workflows: | ||
main: | ||
jobs: | ||
- build | ||
- test: | ||
requires: | ||
- build | ||
- deploy: | ||
requires: | ||
- test | ||
context: writer | ||
- publish: | ||
requires: | ||
- test | ||
context: maintainer | ||
filters: | ||
branches: | ||
only: main | ||
- run: 'true' |
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 |
---|---|---|
@@ -0,0 +1,149 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: | ||
- main | ||
- next | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
initialize: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
teams: ${{ steps.get-teams.outputs.teams }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
|
||
- run: npm ci --ignore-scripts | ||
- id: get-teams | ||
run: echo "teams=$(npm exec garden github-teams -- --user ${{ github.triggering_actor }} --token $GH_TOKEN)" >> $GITHUB_OUTPUT | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
- run: npm exec -- lerna run build --concurrency=2 | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-artifact | ||
path: packages/**/dist | ||
|
||
lint: | ||
needs: [initialize] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
|
||
- run: npm ci --ignore-scripts | ||
- run: npm run lint:ci | ||
|
||
test: | ||
needs: [initialize] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
|
||
- run: npm ci --ignore-scripts | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-artifact | ||
path: packages | ||
|
||
- run: npm run test:ci | ||
- run: npm exec -- coveralls < .cache/coverage/lcov.info | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
|
||
deploy-staging: | ||
if: contains(needs.initialize.outputs.teams, 'Writers') && (github.ref != 'refs/heads/main') | ||
needs: [initialize] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
deployments: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
|
||
- run: npm ci --ignore-scripts | ||
- run: npm run build:demo | ||
- run: utils/scripts/deploy.mjs | ||
env: | ||
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
|
||
deploy: | ||
if: contains(needs.initialize.outputs.teams, 'Writers') && (github.ref == 'refs/heads/main') | ||
needs: [initialize, lint, test] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: 'gh-pages' | ||
cancel-in-progress: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
|
||
- run: npm ci --ignore-scripts | ||
- run: npm run build:demo | ||
|
||
- uses: actions/configure-pages@v5 | ||
- uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: './demo' | ||
- id: deployment | ||
uses: actions/deploy-pages@v4 | ||
|
||
publish: | ||
needs: [initialize, lint, test] | ||
runs-on: ubuntu-latest | ||
if: contains(needs.initialize.outputs.teams, 'Maintainers') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Lerna requires the full history, including tags | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
registry-url: https://registry.npmjs.org # Sets the registry in the project level .npmrc | ||
|
||
- run: npm ci --ignore-scripts | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-artifact | ||
path: packages | ||
|
||
- run: npm exec -- lerna publish from-git --ignore-scripts --yes | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
Oops, something went wrong.