2020-07-29 11:45:51 +02:00
|
|
|
name: Build and Test Suite
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
2020-10-12 10:55:21 +02:00
|
|
|
- main
|
2020-10-26 10:27:44 +01:00
|
|
|
- dev
|
2020-07-29 11:45:51 +02:00
|
|
|
jobs:
|
|
|
|
build-tests:
|
|
|
|
name: Test and Build
|
|
|
|
env:
|
|
|
|
SCCACHE_CACHE_SIZE: "1G"
|
|
|
|
SCCACHE_IDLE_TIMEOUT: 0
|
2020-11-25 18:28:17 +01:00
|
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
2020-07-29 11:45:51 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
platform:
|
2020-10-23 10:43:18 +02:00
|
|
|
- ubuntu-16.04
|
2020-07-29 11:45:51 +02:00
|
|
|
- macos-latest
|
|
|
|
toolchain:
|
|
|
|
- stable
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2020-10-12 10:55:21 +02:00
|
|
|
uses: actions/checkout@main
|
2020-07-29 11:45:51 +02:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Install toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
- name: Cache cargo registry
|
2020-10-23 22:59:18 +02:00
|
|
|
uses: actions/cache@v1.1.2
|
2020-07-29 11:45:51 +02:00
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
|
|
|
key: ${{ runner.os }}-cargo-registry-build-tests-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache cargo index
|
2020-10-23 22:59:18 +02:00
|
|
|
uses: actions/cache@v1.1.2
|
2020-07-29 11:45:51 +02:00
|
|
|
with:
|
|
|
|
path: ~/.cargo/git
|
|
|
|
key: ${{ runner.os }}-cargo-git-build-tests-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache cargo build
|
2020-10-23 22:59:18 +02:00
|
|
|
uses: actions/cache@v1.1.2
|
2020-07-29 11:45:51 +02:00
|
|
|
with:
|
|
|
|
path: target
|
|
|
|
key: ${{ runner.os }}-cargo-build-target-build-tests-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache sccache linux
|
2020-10-23 10:43:18 +02:00
|
|
|
if: matrix.platform == 'ubuntu-16.04'
|
2020-10-23 22:59:18 +02:00
|
|
|
uses: actions/cache@v1.1.2
|
2020-07-29 11:45:51 +02:00
|
|
|
with:
|
|
|
|
path: "/home/runner/.cache/sccache"
|
|
|
|
key: ${{ runner.os }}-sccache-build-tests-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache sccache MacOS
|
|
|
|
if: matrix.platform == 'macos-latest'
|
2020-10-23 22:59:18 +02:00
|
|
|
uses: actions/cache@v1.1.2
|
2020-07-29 11:45:51 +02:00
|
|
|
with:
|
|
|
|
path: "/Users/runner/Library/Caches/Mozilla.sccache"
|
|
|
|
key: ${{ runner.os }}-sccache-build-tests-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install sccache for ${{ matrix.platform }}
|
|
|
|
shell: pwsh
|
|
|
|
run: pwsh scripts/actions/install-sccache.ps1 ${{ runner.os}}
|
|
|
|
- name: Sccache statistics
|
|
|
|
run: sccache --show-stats
|
|
|
|
- name: Build tests
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked --all --release --features "json-tests" --verbose --no-run
|
|
|
|
- name: Run tests for ${{ matrix.platform }}
|
|
|
|
if: matrix.platform != 'windows-latest'
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked --all --release --features "json-tests" --verbose
|
|
|
|
- name: Stop sccache
|
|
|
|
if: always()
|
|
|
|
run: sccache --stop-server
|
|
|
|
- name: Prepare build directory for cache
|
|
|
|
shell: bash
|
|
|
|
run: bash scripts/actions/clean-target.sh
|