Skip to content

chore: merged from origin #1079

chore: merged from origin

chore: merged from origin #1079

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
- run: rustup target add wasm32-unknown-unknown
- name: Run checks
run: bonnie check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
- name: Run traditional tests
run: bonnie test core
cli-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
- run: rustup target add wasm32-unknown-unknown
- name: Run CLI tests
run: bonnie test cli
# We now have a separate job for each example's E2E testing because they all take a while, we may as well run them in parallel
# The job for each E2E test is exactly the same except for a minor difference, so we'll use a matrix based on listing the subdirectories
e2e-example-test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# For now, we list all the examples we're testing, but in future this will be automatic
- name: basic
type: core
- name: capsules
type: core
- name: custom_server
type: core
- name: error_views
type: core
- name: freezing_and_thawing
type: core
- name: global_state
type: core
- name: helper_build_state
type: core
- name: i18n
type: core
- name: idb_freezing
type: core
- name: index_view
type: core
- name: js_interop
type: core
- name: plugins
type: core
- name: preload
type: core
- name: router_state
type: core
- name: rx_state
type: core
- name: set_headers
type: core
- name: state_generation
type: core
- name: static_content
type: core
- name: suspense
type: core
- name: unreactive
type: core
# We want to run as many jobs as we can for debugging, so we can see easily what has actually failed (and re-run failed jobs more quickly)
fail-fast: false
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
# Also cache all the other Cargo files, since plenty of CI runs won't involve different dependencies
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
# # Also cache the apt packages we need for testing
# - uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: firefox
# version: 1.0
# # And finally cache Geckodriver itself
# - uses: actions/cache@v3
# id: geckocache
# with:
# path: |
# ~/.geckodriver
# # The cache should be OS-specific
# key: ${{ runner.os }}-geckodriver
# - name: Install Geckodriver
# if: steps.geckocache.outputs.cache-hit != 'true'
# run: wget -O ~/geckodriver-archive https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz && tar -xvzf ~/geckodriver-archive -C ~/ && mv ~/geckodriver ~/.geckodriver && chmod +x ~/.geckodriver
- run: sudo apt update && sudo apt install firefox
- name: Run Firefox WebDriver
run: geckodriver &
- name: Run E2E tests for example ${{ matrix.name }} in category ${{ matrix.type }}
run: bonnie test example-all-integrations ${{ matrix.type }} ${{ matrix.name }}