Add PageLoader to run tests w/ JSDOM & the browser #20
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 Tests | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build-test: | |
name: "Run Tests" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 21 | |
check-latest: true | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
cache-dependency-path: 'strcalc/src/main/frontend/pnpm-lock.yaml' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Install Node packages | |
run: ./gradlew pnpmInstall | |
- name: Build and test | |
run: ./gradlew build | |
- name: Merge test reports | |
run: ./gradlew merge-test-reports | |
if: always() | |
- name: Generate coverage report | |
run: ./gradlew jacocoXmlTestReport | |
if: always() | |
# Per the advice from: | |
# - https://github.com/marketplace/actions/test-reporter | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-results | |
path: '**/build/test-results/test*/TESTS-TestSuites.xml' | |
- name: Send Java backend test coverage to Coveralls.io | |
uses: coverallsapp/github-action@v2 | |
if: always() | |
with: | |
# The .xml file only contains paths relative to this one. | |
base-path: 'strcalc/src/main/java' | |
file: 'strcalc/build/reports/jacoco/jacocoXmlTestReport/jacocoXmlTestReport.xml' | |
- name: Send JavaScript frontend test coverage to Coveralls.io | |
uses: coverallsapp/github-action@v2 | |
if: always() | |
with: | |
# The lcov file only contains paths relative to this one. | |
base-path: 'strcalc/src/main/frontend' | |
file: 'strcalc/build/reports/frontend/coverage/lcov.info' |