Skip to content

Commit 67f38fe

Browse files
authored
build: Fix and improve builds for Mozilla Firefox requirements (#127)
Should help to resolve codecov/engineering-team#3536 and #124 once a new release is cut.
1 parent a04121e commit 67f38fe

File tree

9 files changed

+6330
-244
lines changed

9 files changed

+6330
-244
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ jobs:
99
ci:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-node@v3
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
1414
with:
1515
node-version: "22"
1616
- run: npm ci
17-
- name: Build extension
17+
- name: Build Chrome extension
1818
run: npm run build
19+
- name: Build Firefox extension
20+
run: npm run build:firefox

.github/workflows/publish.yml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,48 @@ jobs:
1111
publish:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-node@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
1616
with:
1717
node-version: "22"
18+
- name: Create local git tag
19+
# This is necessary to ensure that the tag exists within the
20+
# source archive and can be read by our set-version script.
21+
run: |
22+
git tag "${{ github.event.release.tag_name }}"
1823
- name: Generate source archive
1924
run: npm run archive
2025
- name: Install dependencies
2126
run: npm ci
2227
- name: Build extension
2328
run: npm run build
2429
env:
25-
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
2630
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
27-
- run: |
28-
jq --arg version "$VERSION" '.version=$version' dist/manifest.json > manifest.tmp.json \
29-
&& mv manifest.tmp.json dist/manifest.json
30-
jq --arg version "$VERSION" '.version=$version' dist/manifest.firefox.json > manifest.tmp.json \
31-
&& mv manifest.tmp.json dist/manifest.firefox.json
32-
env:
3331
VERSION: ${{ github.event.release.tag_name }}
34-
- run: |
35-
cp -r dist dist-firefox
36-
mv dist-firefox/manifest.firefox.json dist-firefox/manifest.json
37-
mv codecov-browser-extension.tar.gz dist-firefox
32+
- name: Prepare Firefox extension
33+
run: |
34+
cp -r dist dist-chrome
35+
mv dist/manifest.firefox.json dist/manifest.json
36+
npm run set-version
37+
mv dist dist-firefox
38+
- name: Upload built Chrome extension
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: codecov-chrome-${{ github.event.release.tag_name }}
42+
path: ./dist-chrome/
43+
- name: Upload built Firefox extension
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: codecov-firefox-${{ github.event.release.tag_name }}
47+
path: ./dist-firefox/
48+
- name: Upload source archive
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: codecov-browser-extension.tar.gz
52+
path: codecov-browser-extension.tar.gz
3853
- name: Publish to Chrome
39-
working-directory: dist
40-
run: npx chrome-webstore-upload-cli@2 upload --auto-publish
54+
working-directory: dist-chrome
55+
run: npx chrome-webstore-upload-cli@3
4156
env:
4257
EXTENSION_ID: "gedikamndpbemklijjkncpnolildpbgo"
4358
CLIENT_ID: ${{ secrets.GOOGLE_WEB_STORE_CLIENT_ID }}
@@ -50,4 +65,5 @@ jobs:
5065
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_JWT_ISSUER }}
5166
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_JWT_SECRET }}
5267
WEB_EXT_CHANNEL: listed
53-
WEB_EXT_API_UPLOAD_SOURCE_CODE: codecov-browser-extension.tar.gz
68+
WEB_EXT_API_UPLOAD_SOURCE_CODE: ../codecov-browser-extension.tar.gz
69+
WEB_EXT_APPROVAL_TIMEOUT: 0 # Disable timeout for approval

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist/
44
tmp/
55
.vscode/
66
codecov-browser-extension.tar.gz
7+
.DS_Store

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ If you wish to simply use the extension, it is available as a [Firefox Add On](h
2626

2727
The Codecov browser extension makes it easy to identify needed test areas by showing you absolute coverage and coverage changes overlaid with your code right in GitHub.
2828

29-
Once installed, get:
29+
Once installed, you get:
3030

3131
- Line coverage information while viewing commits and single files
3232
- Line coverage information and coverage totals on Pull Requests
3333
- The ability to filter coverage using Flags and Components directly in the GitHub UI
3434

3535
Pre-requisites:
3636

37-
- Must use either Firefox or Google Chrome web browsers.
37+
- Must use either the Firefox or Google Chrome web browser.
3838

3939
How to enable:
4040

@@ -67,7 +67,11 @@ You can provide this information by using the Settings menu for the Extension in
6767
## Running Locally
6868

6969
```sh
70-
$ web-ext run -s dist -t chromium
70+
$ npm install
71+
# For Chrome
72+
$ npm run start:chrome
73+
# For Firefox
74+
$ npm run start:firefox
7175
```
7276

7377
**Note**: You must be on GitHub's new UI for this extension to perform its magic. ✨
@@ -80,21 +84,31 @@ As of today, GitHub will show you the old UI if not logged in (running in a temp
8084

8185
These steps will build the extension in the `dist/` folder.
8286

83-
Node 22 and npm 10
87+
### Prerequisites
88+
89+
Node 22, `npm` 10, and `git` are required to build the extension.
90+
91+
### Set Local Version
92+
93+
To override the local version of the extension, you can set the `VERSION` environment variable before building. This is useful for testing or development purposes.
8494

85-
Chrome
95+
E.g.
96+
```sh
97+
$ export VERSION=1.0.0
98+
```
99+
100+
### Chrome
86101

87102
```sh
88103
$ npm install
89104
$ npm run build
90105
```
91106

92-
Firefox
107+
### Firefox
93108

94109
```sh
95110
$ npm install
96-
$ npm run build
97-
$ mv dist/manifest.firefox.json dist/manifest.json
111+
$ npm run build:firefox
98112
```
99113

100114
## About Codecov

0 commit comments

Comments
 (0)