Skip to content

Run tests

Run tests #10

Workflow file for this run

name: Run tests
on:
# Run when a release is published
# release:
# types:
# - published
# Allow for manual trigger for now
workflow_dispatch:
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
outputs:
actualResult: ${{ steps.test-run.outcome }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Install Roc
uses: hasnep/setup-roc@main
with:
roc-version: nightly
# TODO this could work if roc could generate a hash of all used dependencies
# # Restore cached roc packages
# - name: Restore roc packages
# uses: actions/cache@v3
# with:
# path: /home/runner/.cache/roc/packages
# key: "roc-packages"
- name: Build Roc app
run: roc build tests.roc
# Get the browser version - it will be used as a cache key to store downloaded browser and driver
- name: Generate browser files cache key
id: cache-key
run: |
key=$(./tests --print-browser-version-only)
echo "Cache key: $key"
echo "key=$key" >> $GITHUB_OUTPUT
# Restore cached browser and driver data using the save browser version as a key
- name: Restore browser files cache
uses: actions/cache@v4
with:
path: ./browser_files
key: ${{ steps.cache-key.outputs.key }}
# Setup browser and driver - setup will be skiped if browser files exist
- name: Setup browser and driver
run: ./tests --setup
# Run tests
- name: Run roc tests
id: test-run
# continue-on-error: true
run: ./tests --headless
- name: Upload docs artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: results
path: testResults/
# Fail the job then the test run failed
- name: Check test results
if: steps.test-run.outcome != 'success'
run: exit 1