recheck again #7
This file contains hidden or 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 Checks | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| env_check: | |
| name: Check for committed .env files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fail if any tracked .env* files exist | |
| shell: bash | |
| run: | | |
| if git ls-files -z | tr '\0' '\n' | grep -E '^\.env($|[^/]*)' >/dev/null; then | |
| echo "::error::A tracked .env* file was found in the repository. Remove it and add '.env*' to .gitignore." | |
| exit 1 | |
| else | |
| echo "No tracked .env* files found." | |
| fi | |
| lint: | |
| name: ESLint | |
| runs-on: ubuntu-latest | |
| needs: env_check | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run linter | |
| run: yarn lint | |
| typecheck: | |
| name: TypeScript Check | |
| runs-on: ubuntu-latest | |
| needs: env_check | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run type check | |
| run: yarn typecheck | |
| build: | |
| name: Build Check | |
| runs-on: ubuntu-latest | |
| needs: [lint, typecheck] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run build | |
| run: yarn build | |
| tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run tests (skip if no script) | |
| shell: bash | |
| run: | | |
| if node -e "const p=require('./package.json'); process.exit(p?.scripts?.test?0:1)"; then | |
| yarn test | |
| else | |
| echo 'No "test" script. Skipping.' | |
| fi |