Update import paths #509
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 | |
on: | |
pull_request: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.cache-key.outputs.key }} | |
store-path: ${{ steps.pnpm-cache.outputs.store-path }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "store-path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
- name: Generate cache key | |
id: cache-key | |
run: | |
echo "key=${{ runner.os }}-pnpm-store-${{ | |
hashFiles('**/pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT | |
format: | |
needs: setup | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ needs.setup.outputs.store-path }} | |
key: ${{ needs.setup.outputs.cache-key }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Check formatting | |
run: pnpm format:check | |
- name: Formatting issues detected (attempting fix...) | |
if: ${{ failure() }} | |
run: pnpm format | |
- name: Commit fixed formatting issues | |
if: ${{ failure() }} | |
uses: stefanzweifel/git-auto-commit-action@v6 | |
with: | |
commit_message: "🧹 style: apply automatic formatting fixes" | |
branch: ${{ github.head_ref }} | |
lint: | |
needs: setup | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ needs.setup.outputs.store-path }} | |
key: ${{ needs.setup.outputs.cache-key }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Lint | |
run: pnpm lint | |
- name: Linting issues detected (attempting fix...) | |
if: ${{ failure() }} | |
run: pnpm lint:fix | |
- name: Commit fixed linting issues | |
if: ${{ failure() }} | |
uses: stefanzweifel/git-auto-commit-action@v6 | |
with: | |
commit_message: "🐛 fix: apply automatic linting fixes" | |
branch: ${{ github.head_ref }} | |
test: | |
needs: [setup, lint, format] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ needs.setup.outputs.store-path }} | |
key: ${{ needs.setup.outputs.cache-key }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run tests | |
run: pnpm test:coverage | |
- name: Download previous coverage artifact | |
uses: actions/download-artifact@v4 | |
continue-on-error: true | |
with: | |
name: test-coverage-{{ matrix.runs-on }} | |
path: previous-coverage/ | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
- name: Comment the new code coverage | |
uses: lucassabreu/comment-coverage-clover@main | |
continue-on-error: true | |
with: | |
file: ./coverage/clover.xml | |
base-file: ./previous-coverage/clover.xml | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload test coverage | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-coverage-{{ matrix.runs-on }} | |
path: coverage/ | |
retention-days: 7 | |
build: | |
needs: [setup, test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ needs.setup.outputs.store-path }} | |
key: ${{ needs.setup.outputs.cache-key }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: build-artifacts-{{ matrix.runs-on }} | |
path: dist/ | |
retention-days: 7 | |
npm-dry-run: | |
needs: [setup, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
registry-url: "https://registry.npmjs.org" | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ needs.setup.outputs.store-path }} | |
key: ${{ needs.setup.outputs.cache-key }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
continue-on-error: true | |
with: | |
name: build-artifacts-{{ matrix.runs-on }} | |
path: dist/ | |
- name: NPM publish dry run | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
access: "public" | |
tag: "next" | |
dry-run: true | |
token: ${{ secrets.NPM_TOKEN }} |