1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-23 13:53:15 +00:00
TiddlyWiki5/.github/workflows/ci.yml
Maurycy Zarzycki 4b56cb4298
Add support for running in-browser tests via playwright in GitHub CLI (#7820)
* Add support for running in-browser tests via playwright in GitHub CLI

* `ci.yml` was updated to store the report so that it can be inspected on failure
* `ci-test.sh` was added as an expansion to `test.sh` which installs and runs playwright
* `playwright.spec.js` does the actual verification of opening the test TW edition in browser, waiting for the tests to finish and then verifying it has indeed passed
* `playwright.config.js` Playwrifht configuration

* Add support for running in-browser tests via playwright in GitHub CLI

* `ci.yml` was updated to store the report so that it can be inspected on failure
* `ci-test.sh` was added as an expansion to `test.sh` which installs and runs playwright
* `playwright.spec.js` does the actual verification of opening the test TW edition in browser, waiting for the tests to finish and then verifying it has indeed passed
* `playwright.config.js` Playwrifht configuration

* Fix file permissions for `ci-test.sh`

* Increased node version for github actions to support playwright

* Add installation of the required @playwright/test library during CI test execution
2023-10-29 09:05:24 +00:00

84 lines
3.4 KiB
YAML

on:
pull_request:
push:
branches:
- master
- tiddlywiki-com
env:
NODE_VERSION: "18"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-test.sh"
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
build-prerelease:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: test
env:
TW5_BUILD_TIDDLYWIKI: "./tiddlywiki.js"
TW5_BUILD_MAIN_EDITION: "./editions/prerelease"
TW5_BUILD_OUTPUT: "./output/prerelease"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-pre-build.sh"
# There's another near-duplicate "Set dynamic environment variables" step in
# the `build-tiddlywiki-com` job.
# These _could_ be extracted as a script (or moved into `ci-pre-build.sh`) to do away with the
# duplication, but, the visibility that comes from having these in the workflow file seems
# valuable. Environment variables are global variables and setting them at the top-level
# makes sense.
# Time to reconsider this decision might be when this setup turns out to be mistake-prone.
- name: "Set dynamic environment variables"
run: |
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo "TW5_BUILD_BRANCH=${TW5_BUILD_BRANCH}" >> $GITHUB_ENV
echo "TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)" >> $GITHUB_ENV
echo "TW5_BUILD_DETAILS=Prerelease built from branch '$TW5_BUILD_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" >> $GITHUB_ENV
- run: "./bin/build-site.sh"
- run: "./bin/ci-push.sh"
env:
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
build-tiddlywiki-com:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/tiddlywiki-com'
needs: test
env:
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
TW5_BUILD_OUTPUT: "./output"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-pre-build.sh"
# When making a change here, don't forget to see if it also applies to the step
# with the same name in the `build-prerelease` job.
- name: "Set dynamic environment variables"
run: |
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo "TW5_BUILD_BRANCH=${TW5_BUILD_BRANCH}" >> $GITHUB_ENV
echo "TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)" >> $GITHUB_ENV
echo "TW5_BUILD_DETAILS=Built from branch '$TW5_BUILD_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" >> $GITHUB_ENV
- run: "./bin/build-site.sh"
- run: "./bin/ci-push.sh"
env:
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
- run: "./bin/build-tw-org.sh"
env:
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}