|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint-and-typecheck: |
| 11 | + name: Lint & Typecheck |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup Node.js |
| 18 | + uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version: 20 |
| 21 | + |
| 22 | + - name: Setup pnpm |
| 23 | + uses: pnpm/action-setup@v4 |
| 24 | + with: |
| 25 | + version: 8 |
| 26 | + |
| 27 | + - name: Get pnpm store directory |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 31 | +
|
| 32 | + - name: Setup pnpm cache |
| 33 | + uses: actions/cache@v4 |
| 34 | + with: |
| 35 | + path: ${{ env.STORE_PATH }} |
| 36 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-pnpm-store- |
| 39 | +
|
| 40 | + - name: Install dependencies |
| 41 | + run: pnpm install --frozen-lockfile |
| 42 | + |
| 43 | + - name: Run ESLint |
| 44 | + run: pnpm lint |
| 45 | + |
| 46 | + - name: Run TypeScript typecheck |
| 47 | + run: pnpm typecheck |
| 48 | + |
| 49 | + - name: Check formatting |
| 50 | + run: pnpm format:check |
| 51 | + |
| 52 | + build: |
| 53 | + name: Build |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - name: Checkout |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Setup Node.js |
| 60 | + uses: actions/setup-node@v4 |
| 61 | + with: |
| 62 | + node-version: 20 |
| 63 | + |
| 64 | + - name: Setup pnpm |
| 65 | + uses: pnpm/action-setup@v4 |
| 66 | + with: |
| 67 | + version: 8 |
| 68 | + |
| 69 | + - name: Get pnpm store directory |
| 70 | + shell: bash |
| 71 | + run: | |
| 72 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 73 | +
|
| 74 | + - name: Setup pnpm cache |
| 75 | + uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: ${{ env.STORE_PATH }} |
| 78 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 79 | + restore-keys: | |
| 80 | + ${{ runner.os }}-pnpm-store- |
| 81 | +
|
| 82 | + - name: Install dependencies |
| 83 | + run: pnpm install --frozen-lockfile |
| 84 | + |
| 85 | + - name: Build site |
| 86 | + run: pnpm build |
| 87 | + env: |
| 88 | + NEXT_PUBLIC_SITE_URL: https://docs.brasa.finance |
| 89 | + |
| 90 | + - name: Upload build artifacts |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: build-output |
| 94 | + path: out |
| 95 | + retention-days: 7 |
| 96 | + |
| 97 | + link-check: |
| 98 | + name: Check Links |
| 99 | + runs-on: ubuntu-latest |
| 100 | + needs: build |
| 101 | + steps: |
| 102 | + - name: Checkout |
| 103 | + uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: Download build artifacts |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + name: build-output |
| 109 | + path: out |
| 110 | + |
| 111 | + - name: Link Checker |
| 112 | + uses: lycheeverse/lychee-action@v2 |
| 113 | + with: |
| 114 | + args: --verbose --no-progress './out/**/*.html' --base './out' --accept 200,201,202,203,204,206,207,208,226 --exclude-mail |
| 115 | + fail: true |
| 116 | + env: |
| 117 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
0 commit comments