Skip to content

Commit

Permalink
Test the release-build process in GitHub Actions (#525)
Browse files Browse the repository at this point in the history
- Add a GitHub action to test the release-build process and make sure we
  don't introduce any reproducibility issues in a new change.

- Show what's different in console output if the release build fails for
  reproducibility reasons (to make troubleshooting easier in GHA).

- Fail install-deps.sh if the already-installed Node version is too old.
  • Loading branch information
josh-berry authored Sep 2, 2024
1 parent d8faefb commit d550deb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Install Dependencies
run: sh ./install-deps.sh
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install Dependencies
run: sh ./install-deps.sh
- name: Install Node Modules
run: make node_modules
- name: Check Types
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/test-release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test-release-build

on:
push:
branches:
- master
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install Dependencies
run: sh ./install-deps.sh
- name: Make a Temporary Version Number (if needed)
run: |
if [ -z "$(git tag --points-at=HEAD)" ]; then
node -e "x=`cat assets/manifest.json`; x.version='9999.99.9999'; console.log(JSON.stringify(x))" >assets/manifest.json.new
mv assets/manifest.json.new assets/manifest.json
make fix-style
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -m 'Make a temporary version number' assets/manifest.json
fi
- name: Try Building Release Artifacts
run: make rel
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ rel:
rel-inner:
$(MAKE) pkg-webext pkg-source
$(MAKE) -C $(RELEASE_DIR)/$(SRCPKG_DIR) release-tag pkg-webext pkg-source
[ -z "$$(diff -Nru dist $(RELEASE_DIR)/$(SRCPKG_DIR)/dist)" ]
@if [ ! -z "$$(diff -Nru dist $(RELEASE_DIR)/$(SRCPKG_DIR)/dist)" ]; then \
diff -Nru dist $(RELEASE_DIR)/$(SRCPKG_DIR)/dist; \
echo "!!!" >&2; \
echo "!!! Build did not reproduce correctly; check diff output above" >&2; \
echo "!!!" >&2; \
exit 1; \
fi
rm -rf $(RELEASE_DIR)/$(SRCPKG_DIR)
@echo ""
@echo "Ready for release $(VERSION)!"
Expand Down Expand Up @@ -198,8 +204,9 @@ site:
## Cleanup

distclean: clean
rm -rf node_modules $(RELEASE_DIR)/$(SRCPKG_DIR) $(SRC_PKG) $(DIST_PKG)
rm -rf docs/vendor
rm -rf node_modules docs/vendor \
$(RELEASE_DIR)/$(SRCPKG_DIR) $(SRC_PKG) $(DIST_PKG) \
releases/*-dirty* releases/*-dev*
.PHONY: distclean

clean:
Expand Down
3 changes: 3 additions & 0 deletions install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ deps_apt() {

sudo apt-get update
sudo apt-get install -y nodejs

elif [ "$(node --version |cut -c2-3)" -lt $NODE_VERSION ]; then
die "Please upgrade Node.js to v$NODE_VERSION or later (you have $(node --version))."
fi
}

Expand Down

0 comments on commit d550deb

Please sign in to comment.