An ATproto social media client -- with an independent Appview.
1# Credit for fingerprint action https://github.com/expo/expo
2# https://github.com/expo/expo/blob/main/.github/workflows/pr-labeler.yml
3---
4name: PR Tests
5
6on:
7 push:
8 branches: [main]
9 pull_request:
10 types: [opened, synchronize]
11
12concurrency:
13 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
14 cancel-in-progress: true
15
16permissions:
17 pull-requests: write
18 actions: write
19 contents: read
20
21jobs:
22 webpack-analyzer:
23 runs-on: ubuntu-22.04
24 if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'}}
25 steps:
26 - name: ⬇️ Checkout
27 uses: actions/checkout@v4
28 with:
29 fetch-depth: 0
30
31 - name: 🔧 Setup Node
32 uses: actions/setup-node@v4
33 with:
34 node-version-file: .nvmrc
35 cache: yarn
36
37 - name: Ensure tracking relevant branches and checkout base
38 run: |
39 git checkout ${{ github.head_ref }}
40 git checkout ${{ github.base_ref }}
41
42 - name: Get the base commit
43 id: base-commit
44 run: echo base-commit=$(git log -n 1 ${{ github.base_ref }} --pretty=format:'%H') >> "$GITHUB_OUTPUT"
45
46 - name: Merge PR commit
47 run: |
48 # Have to set a git config for the merge to work
49 git config --global user.email "github-actions[bot]@users.noreply.github.com"
50 git config --global user.name "github-actions[bot]"
51 git merge --no-edit ${{ github.head_ref }}
52 yarn install
53 yarn intl:build
54
55 - name: 🔦 Generate stats file for PR
56 run: |
57 yarn generate-webpack-stats-file
58 mv stats.json ../stats-new.json
59
60 - name: ⬇️ Get base stats from cache
61 id: get-base-stats
62 uses: actions/cache@v4
63 with:
64 path: stats-base.json
65 key: stats-base-${{ steps.base-commit.outputs.base-commit }}
66
67 - name: Restore to base commit
68 if: ${{ !steps.get-base-stats.outputs.cache-hit }}
69 run: |
70 git reset HEAD~
71 git restore .
72
73 - name: 🔦 Generate stats file from base commit
74 if: ${{ !steps.get-base-stats.outputs.cache-hit }}
75 run: |
76 yarn install
77 yarn intl:build
78 yarn generate-webpack-stats-file
79 mv stats.json stats-base.json
80
81 - name: % Get diff
82 id: get-diff
83 uses: NejcZdovc/bundle-size-diff@v1
84 with:
85 base_path: 'stats-base.json'
86 pr_path: '../stats-new.json'
87 excluded_assets: '(.+).chunk.js|(.+).js.map|(.+).json|(.+).png'
88
89 - name: 💬 Drop a comment
90 uses: marocchino/sticky-pull-request-comment@v2
91 with:
92 header: bundle-diff
93 message: |
94 | Old size | New size | Diff |
95 |----------|----------|-----------------------|
96 | ${{ steps.get-diff.outputs.base_file_string }} | ${{ steps.get-diff.outputs.pr_file_string }} | ${{ steps.get-diff.outputs.diff_file_string }} (${{ steps.get-diff.outputs.percent }}%) |
97 ---
98
99 fingerprint-native:
100 runs-on: ubuntu-22.04
101 if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'}}
102 steps:
103 - name: ⬇️ Checkout
104 uses: actions/checkout@v4
105 with:
106 fetch-depth: 100
107
108 - name: ⬇️ Fetch commits from base branch
109 run: git fetch origin main:main --depth 100
110 if: github.event_name == 'pull_request'
111
112 - name: 🔧 Setup Node
113 uses: actions/setup-node@v4
114 with:
115 node-version-file: .nvmrc
116 cache: yarn
117
118 - name: 📷 Check fingerprint and install dependencies
119 id: fingerprint
120 uses: bluesky-social/github-actions/fingerprint-native@main
121 with:
122 profile: pull-request
123
124 - name: 💬 Drop a comment
125 uses: marocchino/sticky-pull-request-comment@v2
126 if: ${{ steps.fingerprint.outputs.includes-changes }}
127 with:
128 header: fingerprint-diff
129 message: |
130 The Pull Request introduced fingerprint changes against the base commit:
131 <details><summary>Fingerprint diff</summary>
132
133 ```json
134 ${{ steps.fingerprint.outputs.diff }}
135 ```
136
137 </details>
138
139 ---
140 *Generated by [PR labeler](https://github.com/expo/expo/actions/workflows/pr-labeler.yml) 🤖*
141
142 - name: 💬 Delete comment
143 uses: marocchino/sticky-pull-request-comment@v2
144 if: ${{ !steps.fingerprint.outputs.includes-changes }}
145 with:
146 header: fingerprint-diff
147 delete: true