2020-06-28 06:16:38 +03:00
name : CI
on :
pull_request :
2021-07-15 02:35:20 +03:00
push :
branches :
- master
- staging
- trying
paths-ignore :
- 'docs/**'
- 'documentation/**'
2020-06-28 06:16:38 +03:00
env :
RUST_BACKTRACE : 1
jobs :
2021-07-14 23:59:51 +03:00
test-package :
name : Test Package ${{ matrix.os }}
runs-on : ${{ matrix.os }}
strategy :
2021-07-15 02:35:20 +03:00
matrix :
os : [ macOS-latest, windows-latest, ubuntu-latest]
include :
- os : ubuntu-latest
sccache-path : /home/runner/.cache/sccache
- os : macos-latest
sccache-path : /Users/runner/Library/Caches/Mozilla.sccache
- os : windows-latest
sccache-path : "C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache"
2020-12-01 01:06:46 +03:00
env :
2021-07-14 23:59:51 +03:00
RUSTC_WRAPPER : sccache
SCCACHE_CACHE_SIZE : 2G
SCCACHE_DIR : ${{ matrix.sccache-path }}
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out
2020-09-14 07:53:53 +03:00
steps :
- name : Checkout
uses : actions/checkout@v2
2021-07-14 23:59:51 +03:00
- name : Install sccache Ubuntu
if : matrix.os == 'ubuntu-latest'
env :
LINK : https://github.com/mozilla/sccache/releases/download
2021-07-15 02:35:20 +03:00
SCCACHE_VERSION : v0.2.15
2021-07-14 23:26:32 +03:00
run : |
2021-07-14 23:59:51 +03:00
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
2021-07-15 02:35:20 +03:00
chmod +x $HOME/.local/bin/sccache
2021-07-14 23:59:51 +03:00
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name : Install sccache Macos
if : matrix.os == 'macos-latest'
2021-07-14 23:26:32 +03:00
run : |
2021-07-14 23:59:51 +03:00
brew update
brew install sccache
2021-07-14 23:26:32 +03:00
2021-07-14 23:59:51 +03:00
- name : Install sccache Windows
if : matrix.os == 'windows-latest'
run : |
iwr -useb get.scoop.sh | iex
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
scoop install sccache
2021-07-15 02:35:20 +03:00
echo "C:\Users\runneradmin\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
2021-07-14 23:26:32 +03:00
- name : Install Rust Stable
uses : actions-rs/toolchain@v1
with :
profile : minimal
toolchain : stable
2020-09-14 07:53:53 +03:00
override : true
2021-07-14 23:59:51 +03:00
- name : Cache cargo registry
uses : actions/cache@v2
continue-on-error : false
2021-07-14 23:55:01 +03:00
with :
2021-07-14 23:59:51 +03:00
path : |
~/.cargo/registry
~/.cargo/git
key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
${{ runner.os }}-cargo-
- name : Save sccache
uses : actions/cache@v2
continue-on-error : false
with :
path : ${{ matrix.sccache-path }}
key : ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
${{ runner.os }}-sccache-
- name : Start sccache server
2021-07-15 02:35:20 +03:00
run : |
sccache --start-server
2021-07-14 23:59:51 +03:00
2021-07-14 23:55:01 +03:00
- name : Test
2021-08-12 12:25:43 +03:00
uses : actions-rs/cargo@v1
with :
command : test
args : --all --features ci_skip -- --nocapture
env :
CARGO_INCREMENTAL : "0"
2021-07-14 23:55:01 +03:00
2021-07-14 23:59:51 +03:00
- name : Print sccache stats
run : sccache --show-stats
- name : Stop sccache server
run : sccache --stop-server || true
2021-07-14 23:55:01 +03:00
test-package-macos_m1 :
name : Test Package macOS M1
runs-on : macos-latest
2021-07-15 03:52:57 +03:00
env :
RUSTC_WRAPPER : sccache
SCCACHE_CACHE_SIZE : 2G
SCCACHE_DIR : /Users/runner/Library/Caches/Mozilla.sccache
2021-07-14 23:55:01 +03:00
steps :
- name : Xcode Select
uses : devbotsxyz/xcode-select@v1.1.0
- name : Checkout
uses : actions/checkout@v2
2021-07-15 03:52:57 +03:00
- name : Install sccache
run : |
brew update
brew install sccache
2021-07-14 23:55:01 +03:00
- name : Install Rust
uses : actions-rs/toolchain@v1
with :
profile : minimal
target : aarch64-apple-darwin
toolchain : stable
override : true
components : rustfmt
2021-07-15 03:52:57 +03:00
- name : Cache cargo registry
uses : actions/cache@v2
continue-on-error : false
with :
path : |
~/.cargo/registry
~/.cargo/git
key : m1-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
m1-cargo-
- name : Save sccache
uses : actions/cache@v2
continue-on-error : false
with :
path : /Users/runner/Library/Caches/Mozilla.sccache
key : m1-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
m1-sccache-
- name : Start sccache server
run : |
sccache --start-server
2021-07-14 23:55:01 +03:00
- name : Test
run : |
SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \
2021-08-12 12:25:43 +03:00
cd package && cargo test --all --features ci_skip -- --nocapture
2021-07-14 23:55:01 +03:00
2021-07-15 03:52:57 +03:00
- name : Print sccache stats
run : sccache --show-stats
- name : Stop sccache server
run : sccache --stop-server || true
2021-08-11 05:59:27 +03:00
test-docs :
name : Test Docs
runs-on : ubuntu-latest
env :
RUSTC_WRAPPER : sccache
SCCACHE_CACHE_SIZE : 2G
SCCACHE_DIR : /home/runner/.cache/sccache
steps :
- name : Checkout
uses : actions/checkout@v2
with :
ref : master
- name : Install sccache
env :
LINK : https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION : v0.2.15
run : |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name : Cache cargo registry
uses : actions/cache@v2
continue-on-error : false
with :
path : |
~/.cargo/registry
~/.cargo/git
key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
${{ runner.os }}-cargo-
- name : Install Rust Stable
uses : actions-rs/toolchain@v1
with :
profile : minimal
toolchain : stable
override : true
2021-08-11 10:09:22 +03:00
- name : Save sccache
uses : actions/cache@v2
continue-on-error : false
with :
path : /home/runner/.cache/sccache
key : ubuntu-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys : ubuntu-sccache-
2021-08-11 05:59:27 +03:00
- name : Start sccache server
run : sccache --start-server
- name : Build Cargo Docs
env :
RUSTDOCFLAGS : "--enable-index-page -Zunstable-options"
RUSTC_BOOTSTRAP : "1"
run : |
cargo doc --no-deps --document-private-items --workspace
rm -rf ./tests
- name : Print sccache stats
run : sccache --show-stats
- name : Stop sccache server
run : sccache --stop-server || true
2021-03-16 08:53:26 +03:00
codecov :
name : Code Coverage
runs-on : ubuntu-latest
2021-07-14 23:55:01 +03:00
env :
2021-07-14 23:59:51 +03:00
RUSTC_BOOTSTRAP : 1
2021-08-11 10:09:22 +03:00
RUSTC_WRAPPER : sccache
SCCACHE_CACHE_SIZE : 2G
SCCACHE_DIR : /home/runner/.cache/sccache
2021-03-16 08:53:26 +03:00
steps :
- name : Checkout
uses : actions/checkout@v1
2021-08-11 10:09:22 +03:00
- name : Install sccache Ubuntu
env :
LINK : https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION : v0.2.15
run : |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
2021-07-15 03:52:57 +03:00
2021-03-16 08:53:26 +03:00
- name : Install Rust
uses : actions-rs/toolchain@v1
with :
profile : minimal
2021-07-14 23:55:01 +03:00
toolchain : stable
2021-03-16 08:53:26 +03:00
override : true
components : rustfmt
2021-08-11 10:09:22 +03:00
- name : Cache cargo registry
uses : actions/cache@v2
continue-on-error : false
with :
path : |
~/.cargo/registry
~/.cargo/git
key : codecov-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
codecov-cargo-
- name : Save sccache
uses : actions/cache@v2
continue-on-error : false
with :
path : /Users/runner/Library/Caches/Mozilla.sccache
key : codecov-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys : |
codecov-sccache-
- name : Start sccache server
run : |
sccache --start-server
2021-07-14 23:59:51 +03:00
- name : Test
uses : actions-rs/cargo@v1
with :
command : test
2021-08-12 12:25:43 +03:00
args : --all --features ci_skip -- --nocapture
2021-07-14 23:59:51 +03:00
env :
CARGO_INCREMENTAL : "0"
2021-03-16 08:53:26 +03:00
- name : Install dependencies for code coverage
run : |
sudo apt-get update
sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
- name : Generate coverage report
run : |
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
tar xzf master.tar.gz
cd kcov-master
mkdir build && cd build
cmake .. && make
make install DESTDIR=../../kcov-build
cd ../..
rm -rf kcov-master
for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done
- name : Upload coverage to Codecov
uses : codecov/codecov-action@v1
with :
github-token : ${{ secrets.GITHUB_TOKEN }}
2021-08-11 10:09:22 +03:00
token : ${{ secrets.CODECOV_TOKEN }}
- name : Print sccache stats
run : sccache --show-stats
- name : Stop sccache server
run : sccache --stop-server || true