chore(deps): Automated dependency upgrades #305
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: Run WPT | |
on: | |
push: | |
pull_request: | |
types: [opened, reopened] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
WPT_MANIFEST: ${{ github.workspace }}/wpt/MANIFEST.json | |
WPT_REPO: web-platform-tests/wpt | |
WPT_REF: master | |
SOURCE_REPO: ${{ github.repository }} | |
SOURCE_COMMIT: ${{ github.sha }} | |
SOURCE_BRANCH: ${{ github.ref_name }} | |
RESULTS_BRANCH: ${{ github.ref_name }}--wpt-results | |
jobs: | |
test: | |
name: Run WPT | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' || github.event.action == 'reopened' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check if WPT results branch exists | |
id: results-branch-exists | |
run: echo "EXISTS=$(git ls-remote --heads origin $RESULTS_BRANCH | wc -l)" >> $GITHUB_OUTPUT | |
- name: Create WPT results branch | |
if: steps.results-branch-exists.outputs.EXISTS == '0' | |
run: | | |
git checkout --orphan $RESULTS_BRANCH | |
git rm -rf . | |
mkdir test-results | |
touch test-results/history.html | |
git add . | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "Initial WPT history commit" | |
git push origin $RESULTS_BRANCH | |
git switch ${{ github.ref_name }} | |
- name: Clone WPT results branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.RESULTS_BRANCH }} | |
path: wpt-results | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: yarn | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Clone WPT repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.WPT_REPO }} | |
ref: ${{ env.WPT_REF }} | |
path: wpt | |
- name: Get WPT commit SHA | |
run: echo "WPT_COMMIT=$(cd wpt; git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Build polyfill | |
run: | | |
yarn install --immutable | |
yarn build:wpt | |
- name: Setup WPT | |
run: | | |
cd wpt | |
pip install virtualenv | |
./wpt make-hosts-file | sudo tee -a /etc/hosts | |
- name: Run Tests | |
run: | | |
cd tests | |
python3 -m http.server 9606 & | |
cd ../wpt | |
./wpt manifest | |
./wpt serve --inject-script=${{ github.workspace }}/dist/css-anchor-positioning-wpt.umd.cjs & | |
cd .. | |
cp -r wpt-results/test-results . | |
yarn test:wpt | |
- name: Push to WPT results branch | |
run: | | |
rsync -a test-results/ wpt-results/test-results/ | |
cd wpt-results | |
git add test-results | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "WPT results from https://github.com/${{ github.repository }}/commit/${{ github.sha }}" | |
git push origin $RESULTS_BRANCH | |
link-to-report: | |
name: Link to report | |
runs-on: ubuntu-latest | |
if: github.event.action == 'opened' | |
steps: | |
- name: Link to WPT report (only on first run) | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: > | |
gh --repo ${{ github.repository }} | |
pr comment ${{ github.event.pull_request.number }} | |
--body "WPT report for this branch: https://${{ github.head_ref }}-wpt-results--anchor-position-wpt.netlify.app" |