Create your Link in Bio for Bluesky
1name: Test
2
3on:
4 push:
5 branches:
6 - main
7 pull_request:
8
9jobs:
10 unit-test:
11 runs-on: ubuntu-latest
12 steps:
13 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
14 - run: |
15 npm i -g corepack@latest
16 corepack enable pnpm
17 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
18 with:
19 node-version-file: .node-version
20 cache: pnpm
21 - run: pnpm i
22 - run: pnpm typecheck
23 - run: pnpm lint
24 - run: pnpm test -- --coverage
25 e2e-test:
26 runs-on: ubuntu-latest
27 permissions:
28 pull-requests: write
29 steps:
30 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
31 - run: |
32 npm i -g corepack@latest
33 corepack enable pnpm
34 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
35 with:
36 node-version-file: .node-version
37 cache: pnpm
38 - run: |
39 ATPROTO_COMMIT=$(cat .atproto-version)
40 echo "ATPROTO_COMMIT=$ATPROTO_COMMIT" >> $GITHUB_ENV
41 NODE_VERSION=$(node -v)
42 echo "NODE_VERSION=$NODE_VERSION" >> $GITHUB_ENV
43 - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
44 with:
45 path: ~/.cache/atproto/${{ env.ATPROTO_COMMIT }}
46 key: atproto-${{ env.ATPROTO_COMMIT }}-node-${{ env.NODE_VERSION }}
47 - run: pnpm i
48 - run: pnpm playwright install --with-deps
49 - run: cp .env.example .env
50 - run: pnpm setup-dev
51 - run: pnpm build
52 - run: pnpm e2e
53 # https://www.cloudflarestatus.com/incidents/t5nrjmpxc1cj
54 - uses: unfor19/install-aws-cli-action@f5b46b7f32cf5e7ebd652656c5036bf83dd1e60c # v1
55 if: always() && (github.ref == 'refs/heads/main' || github.actor == 'mkizka')
56 with:
57 version: 2.22.35
58 - name: Upload Report
59 if: always() && (github.ref == 'refs/heads/main' || github.actor == 'mkizka')
60 run: |
61 E2E_S3_PATH="playwright-report/${{ github.ref == 'refs/heads/main' && 'main' || github.sha }}"
62 aws s3 cp playwright-report "s3://$E2E_S3_PATH" --recursive
63 echo "E2E_REPORT_URL=${{ vars.S3_BASE_URL }}/$E2E_S3_PATH/index.html" >> $GITHUB_ENV
64 env:
65 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
66 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
67 AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }}
68 AWS_DEFAULT_REGION: auto
69 - name: Comment on PR
70 if: always() && github.ref != 'refs/heads/main' && github.actor == 'mkizka'
71 run: |
72 BODY="## E2E Test Report
73 📊 [View Report]($E2E_REPORT_URL)"
74 gh pr comment ${{ github.event.number }} --body "$BODY" --edit-last --create-if-none
75 env:
76 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}