Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: migrate from CircleCI to Github Actions #1836

Merged
merged 36 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
96f6960
chore: remove CCI config
ze-flo Jun 11, 2024
eacdeb7
chore: add lint:ci script
ze-flo Jun 11, 2024
0c3ee46
refactor: get IGardenTheme from src rather than ./dist
ze-flo Jun 11, 2024
e8c3827
ci: setup GHA main workflow
ze-flo Jun 11, 2024
d88f5df
ci: make test dependent on build step
ze-flo Jun 11, 2024
28bdf5c
ci: maintain compatibility w/ @zendeskgarden/scripts
ze-flo Jun 11, 2024
c824a85
test: set test:ci to silent
ze-flo Jun 11, 2024
03cb1a5
chore: tweak + clean up CI config
ze-flo Jun 11, 2024
b7d41bb
Revert "chore: remove CCI config"
ze-flo Jun 11, 2024
d865963
ci: add temp CCI config for transition
ze-flo Jun 13, 2024
6b17681
fix: trigger workflow on pull_request open, sync, reopened
ze-flo Jun 14, 2024
a149e1a
chore: remove redundant conditional
ze-flo Jun 14, 2024
f2c080e
chore: use REPO_SLUG to get ower + repo name (WIP)
ze-flo Jun 14, 2024
f566924
ci: smoke-test npm whoami
ze-flo Jun 14, 2024
479f248
chore: PR feedback
ze-flo Jun 17, 2024
f6910c1
ci: restore cci config without deploy
ze-flo Jun 17, 2024
fd80114
chore: PR feedback
ze-flo Jun 18, 2024
40b06f3
ci: drop name fields
ze-flo Jun 18, 2024
7d18b05
ci: check team membership before deploying and publishing (dry-run)
ze-flo Jun 26, 2024
f81f2f3
ci: use correct token
ze-flo Jun 27, 2024
46f344a
ci: restore jobs config
ze-flo Jun 27, 2024
00a4e8a
ci: test with gh-pages actions
ze-flo Jun 28, 2024
b5240e0
trying to re-trigger GHA
ze-flo Jun 28, 2024
b8ce1dd
refactor: only deploy to preview host
ze-flo Jun 28, 2024
ded342c
ci: smoke-test
ze-flo Jun 28, 2024
8c82cc2
deps: bump @zendeskgarden/scripts
ze-flo Jun 28, 2024
09a4dbf
fix: add back required GITHUB_TOKEN
ze-flo Jun 28, 2024
41001b0
ci: fix permissions
ze-flo Jun 28, 2024
abf1547
ci: uncomment
ze-flo Jun 28, 2024
02ffe95
chore: rename deploy jobs + script
ze-flo Jun 28, 2024
eff3aee
Sweep up and enable `publish` job
jzempel Jul 1, 2024
2e07159
Fix circle config
jzempel Jul 1, 2024
d89fbd8
Fix circle config
jzempel Jul 1, 2024
7fd42cc
Add missing CCI executor
jzempel Jul 1, 2024
dbb478c
Fix for default CCI `build` job
jzempel Jul 1, 2024
c480551
Constrain `deploy-staging` to non-main branches
jzempel Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 3 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
149 changes: 149 additions & 0 deletions .github/workflows/ci.yaml
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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is fine for now, but we'll need to allow version maintenance branches (i.e. v7, v8, etc) as well, so may need to weigh the idea of removing and relying solely on Lerna's allowBranch config.

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 }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull Request Labels
name: PR
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
Expand All @@ -10,4 +10,4 @@ jobs:
with:
mode: exactly
count: 1
labels: "PR: Breaking Change :boom:, PR: Bug Fix :bug:, PR: Docs :memo:, PR: Internal :seedling:, PR: New Feature :rocket:"
labels: 'PR: Breaking Change :boom:, PR: Bug Fix :bug:, PR: Docs :memo:, PR: Internal :seedling:, PR: New Feature :rocket:'
Loading