Manifest V3 Support #460
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Extension Builder | |
# Run this workflow every time a new commit pushed to your repository | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
test-javascript-libraries: | |
name: Test the Javascript libraries | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: browser-extensions/common/js/tests | |
steps: | |
# Checks out a copy of your repository on the ubuntu-latest machine | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Configure node v20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install test framework dependencies | |
run: npm install | |
- name: Run tests | |
run: npm run test-with-coverage | |
# Set the job key. The key is displayed as the job name | |
# when a job name is not provided | |
build-extension: | |
# Name the Job | |
name: Build the extension | |
# Set the type of machine to run on | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
browser: ["chrome", "firefox"] | |
steps: | |
# Checks out a copy of your repository on the ubuntu-latest machine | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Configure node v20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install web-ext tooling | |
run: npm install -g web-ext | |
# Runs a script | |
- name: Build ${{ matrix.browser }} Extension | |
run: | | |
echo "Building extension for ${{ matrix.browser }} at `date`" | |
# Make the build script executable | |
chmod +x ./build/extension-${{ matrix.browser }}/build.sh | |
# Build the extension | |
./build/extension-${{ matrix.browser }}/build.sh | |
shell: bash | |
env: | |
EXTENSION_BUILD_ID: ${{ github.run_number }} | |
- name: Upload build extension package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.browser }}-extension-package | |
path: browser-extensions/${{ matrix.browser }}/build/web-ext-artifacts/running_challenges-*.zip | |
integration-test: | |
name: UI Testing | |
runs-on: ubuntu-latest | |
needs: | |
- build-extension | |
- test-javascript-libraries | |
strategy: | |
matrix: | |
country_hostname: | |
- "parkrun.ca" | |
- "parkrun.co.at" | |
- "parkrun.co.nl" | |
- "parkrun.co.nz" | |
- "parkrun.co.za" | |
- "parkrun.com.au" | |
- "parkrun.us" | |
- "parkrun.dk" | |
- "parkrun.fi" | |
- "parkrun.fr" | |
- "parkrun.ie" | |
- "parkrun.it" | |
- "parkrun.jp" | |
- "parkrun.lt" | |
- "parkrun.my" | |
- "parkrun.no" | |
- "parkrun.org.uk" | |
- "parkrun.pl" | |
- "parkrun.se" | |
- "parkrun.sg" | |
# - "parkrun.ru" # Russian events are suspended | |
fail-fast: false | |
# max-parallel: 1 | |
defaults: | |
run: | |
shell: bash | |
working-directory: browser-extensions/common/js/tests/ui-test | |
steps: | |
# Checks out a copy of the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Get previously built packages | |
- name: Download all built extension packages | |
uses: actions/download-artifact@v4 | |
with: | |
path: browser-extensions/common/js/tests/ui-test/extension-binaries | |
- name: Show built extension packages | |
run: ls -lR extension-binaries | |
- name: Configure node v20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install Required OS packages | |
run: | | |
sudo apt-get update && \ | |
sudo apt-get install -y xvfb unzip | |
- name: Start up the supporting nginx services | |
run: | | |
echo "Creating a certificate" | |
cd ./supporting-data/nginx/cert/ | |
bash generate.sh | |
cd - | |
echo "Starting up docker compose services" | |
docker compose -f "./supporting-data/docker-compose-gh-actions.yml" up --force-recreate -d | |
# Give nginx a moment to have fully come up | |
sleep 1 | |
# Make the changes to /etc/hosts so that the tests reference the above containers. | |
echo "Append to /etc/hosts to use this nginx" | |
sudo bash -c 'cat ./supporting-data/etc-hosts.txt >> /etc/hosts' | |
- name: Unpack extension | |
run: | | |
ls -lR extension-binaries | |
cd extension-binaries/chrome-extension-package | |
unzip *.zip | |
- name: Install Node dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: | | |
npx playwright install --with-deps chromium | |
- name: Run Playwright tests | |
run: xvfb-run npx playwright test | |
env: | |
COUNTRY_HOSTNAME: "${{ matrix.country_hostname }}" | |
- name: list files in root dir | |
run: ls -l | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ui-tests-chrome-${{ matrix.country_hostname }} | |
path: | | |
browser-extensions/common/js/tests/ui-test/playwright-report/ | |
browser-extensions/common/js/tests/ui-test/screenshot.png | |
retention-days: 30 | |
# This stage will run once the extensions have been built, and should only run if they were successful. | |
# Assuming they are successful, we will push them somewhere they can be used. | |
# If we are on the master branch, and it is tagged as a release versino, we should create a release | |
publish-extension: | |
name: Push the build extensions somewhere | |
runs-on: ubuntu-latest | |
needs: | |
- integration-test | |
# if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download all built extension packages | |
uses: actions/download-artifact@v4 | |
with: | |
path: extension-binaries | |
- name: Show built extension packages | |
run: ls -lR extension-binaries | |
- id: get-branch-version-tag | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
console.log(context) | |
console.log(context.ref) | |
console.log(github.ref) | |
// This script will create a release, and upload our files and release notes to it | |
if (!"${{ github.ref }}".startsWith('refs/tags/v')) { | |
return | |
} | |
// Find the version tag | |
var version_tag = github.ref.replace("refs/tags/", "") | |
console.log(version_tag) | |
// Store it in the step output variables | |
core.setOutput('version_tag', version_tag) | |
/* | |
// TODO: Do we need to check if this release already exists? | |
// Create a release | |
github.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: version_tag, | |
name: <name of the release>, | |
body: <text for the release>, | |
draft: false, | |
prelease: false, | |
}) | |
// Upload all the artifacts to it | |
github.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: ... | |
}) | |
*/ | |
# if: startsWith(github.ref, 'refs/tags/v') | |
# - id: get-branch-version-tag | |
# uses: actions/github-script@v7 | |
# with: | |
# script: | | |
# var version_tag = '' | |
# if (github.ref.startsWith('refs/tags/v')){ | |
# version_tag = github.ref.split('/')[2] | |
# } | |
# core.setOutput('version_tag', version_tag) | |
# if: startsWith(github.ref, 'refs/tags/v') | |
- run: echo "branch version tag is ${{steps.get-branch-version-tag.outputs.version_tag}}" | |
# if: startsWith(github.ref, 'refs/tags/v') | |
# We might be able to use the github script action instead of this to script what we need to do in one go | |
- name: Create release | |
uses: softprops/action-gh-release@v1 # Read the docs here: https://github.com/softprops/action-gh-release | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
name: Running Challenges ${{steps.get-branch-version-tag.outputs.version_tag}} | |
files: "extension-binaries/*/running_challenges*.zip" | |
body: | | |
Release notes go here | |
# body_path: Auto/manually generated file for release notes goes here | |
fail_on_unmatched_files: True | |
draft: True # We'll move it to release when it's all tested and known to be working | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |