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 22 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
14 changes: 1 addition & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,11 @@ jobs:
<<: *executor
steps:
- *attach_workspace
- run: npm run lint:ci
- 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:
Expand All @@ -61,10 +53,6 @@ workflows:
- test:
requires:
- build
- deploy:
requires:
- test
context: writer
- publish:
requires:
- test
Expand Down
153 changes: 153 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
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: echo "Building"
- 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-preview:
if: contains(needs.initialize.outputs.teams, 'Writers')
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 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-gh-pages:
# if: contains(needs.initialize.outputs.teams, 'Writers') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To clarify, this will only trigger following a push event.

For push events, github.ref looks something like this refs/heads/{branch}

For pull_request events, github.ref > refs/pull/{PR#}/merge

if: contains(needs.initialize.outputs.teams, 'Writers')
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:
- env:
TEAMS: ${{needs.initialize.outputs.teams}}
run: echo "$TEAMS"
- run: echo "Publishing"
# - 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 }}
Loading