WIP: experimental dark mode detection #3
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 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
affected: ${{ steps.set-affected.outputs.affected }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
foundations: 'packages/foundations/**' | |
ui: 'packages/ui/**' | |
storybook: 'apps/storybook/**' | |
demo: 'apps/demo/**' | |
eslint-config: 'packages/eslint-config/**' | |
typescript-config: 'packages/typescript-config/**' | |
- id: set-affected | |
run: | | |
if [[ "${{ steps.filter.outputs.foundations }}" == "true" || \ | |
"${{ steps.filter.outputs.ui }}" == "true" || \ | |
"${{ steps.filter.outputs.eslint-config }}" == "true" || \ | |
"${{ steps.filter.outputs.typescript-config }}" == "true" ]]; then | |
echo "affected=all" >> $GITHUB_OUTPUT | |
elif [[ "${{ steps.filter.outputs.storybook }}" == "true" ]]; then | |
echo "affected=storybook" >> $GITHUB_OUTPUT | |
elif [[ "${{ steps.filter.outputs.demo }}" == "true" ]]; then | |
echo "affected=demo" >> $GITHUB_OUTPUT | |
else | |
echo "affected=none" >> $GITHUB_OUTPUT | |
fi | |
lint-build-test: | |
needs: detect-changes | |
if: needs.detect-changes.outputs.affected != 'none' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint, Build, and Test All | |
if: needs.detect-changes.outputs.affected == 'all' | |
run: | | |
npm run lint | |
npm run build | |
npm test | |
- name: Lint, Build, and Test Storybook | |
if: needs.detect-changes.outputs.affected == 'storybook' | |
run: | | |
npm run lint -w @avinode-ds/storybook | |
npm run build -w @avinode-ds/storybook | |
npm test -w @avinode-ds/storybook | |
- name: Lint, Build, and Test Demo | |
if: needs.detect-changes.outputs.affected == 'demo' | |
run: | | |
npm run lint -w @avinode-ds/demo | |
npm run build -w @avinode-ds/demo | |
npm test -w @avinode-ds/demo |