Use better CI generation #3319
Workflow file for this run
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
name: CI | |
# Inspiration: | |
# https://github.com/alexdiliberto/ember-transformicons/blob/master/.github/workflows/ci.yml | |
on: | |
pull_request: | |
push: | |
# filtering branches here prevents duplicate builds from pull_request and push | |
branches: | |
- master | |
- main | |
env: | |
CI: true | |
jobs: | |
install_dependencies: | |
name: Install Dependencies | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
############################################################# | |
lint: | |
name: Lint JS | |
runs-on: ubuntu-latest | |
needs: ['install_dependencies'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
- run: pnpm lint:js | |
lint_docs: | |
name: Lint Docs | |
runs-on: ubuntu-latest | |
needs: ['install_dependencies'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
- run: pnpm lint:docs | |
lint_readme: | |
name: README up to date | |
runs-on: ubuntu-latest | |
needs: ['install_dependencies'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
- run: pnpm run update && git diff --exit-code README.md docs/ | |
############################################################# | |
tests_setup: | |
name: Tests' Setup | |
runs-on: ubuntu-latest | |
needs: ['install_dependencies'] | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
- id: set-matrix | |
run: | | |
matrix_json=$(node ./ci-test-matrix.mjs) | |
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT | |
tests: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
needs: ['tests_setup'] | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.tests_setup.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
pnpm-version: ${{ matrix.pnpm }} | |
- name: "Use ${{ matrix.eslint }}" | |
run: | | |
pnpm remove eslint | |
pnpm add ${{ matrix.eslint }} -w | |
pnpm install | |
- name: Test with node@${{ matrix.node }} & pnpm@${{ matrix.pnpm }} | |
run: | | |
echo "Matrix Info" | |
echo "Intended: node@${{ matrix.node }}, eslint@${{ matrix.eslint }}, pnpm@${{ matrix.pnpm }}" | |
echo "node: $(node -v)" | |
echo "pnpm: $(pnpm --version)" | |
echo "pnpm why eslint" | |
pnpm why eslint | |
pnpm test | |
smoke-tests: | |
name: Smoke Tests | |
runs-on: ubuntu-latest | |
needs: ['install_dependencies'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wyvox/action-setup-pnpm@v3 | |
- run: pnpm --filter './smoke-tests/**' exec eslint . | |
# https://github.com/changesets/action | |
release: | |
name: Release | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: wyvox/action-setup-pnpm@v3 | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
# This expects you to have a script called release which does a build for your packages | |
# and calls changeset publish | |
publish: pnpm release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |