Skip to content

Apply performance improvements #334

Apply performance improvements

Apply performance improvements #334

Workflow file for this run

#
# Copyright © 2020-today Peter M. Stahl pemistahl@gmail.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: build
on:
push:
branches:
- main
paths:
- 'Cargo.lock'
- 'Cargo.toml'
- 'src/**'
- 'tests/**'
- '**.yml'
pull_request:
branches:
- main
paths:
- 'Cargo.lock'
- 'Cargo.toml'
- 'src/**'
- 'tests/**'
- '**.yml'
jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
name: Linux Binary 64-Bit
target: x86_64-unknown-linux-musl
- os: macos-latest
name: MacOS Binary 64-Bit
target: x86_64-apple-darwin
env:
MACOSX_DEPLOYMENT_TARGET: 10.7
- os: windows-latest
name: Windows Binary 64-Bit
target: x86_64-pc-windows-msvc
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Add rustup target
run: rustup target add ${{ matrix.target }}
- name: Install apt packages
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install musl-tools libssl-dev
sudo ln -s /usr/bin/g++ /usr/bin/musl-g++
# needed to fix file corruption of cache
# https://github.com/actions/cache/issues/403
- name: Install GNU tar
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Install wasm-pack
if: ${{ matrix.os == 'ubuntu-latest' }}
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Store or retrieve cargo caches
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build in debug mode
run: cargo build --target ${{ matrix.target }} --locked
- name: Run unit tests
run: cargo test --target ${{ matrix.target }}
- name: Run WASM integration tests on NodeJS
if: ${{ matrix.os == 'ubuntu-latest' }}
run: wasm-pack test --node
- name: Run WASM integration tests in Chrome
if: ${{ matrix.os == 'ubuntu-latest' }}
run: wasm-pack test --headless --chrome
- name: Run WASM integration tests in Firefox
if: ${{ matrix.os == 'ubuntu-latest' }}
run: wasm-pack test --headless --firefox
# fixme: fork and fix tarpaulin action or find a replacement
#
# - name: Create code coverage report
# if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'push' }}
# uses: actions-rs/tarpaulin@v0.1
# with:
# args: '--lib --ignore-config --ignore-panics --ignore-tests --exclude-files src/wasm.rs'
# - name: Upload code coverage report to Codecov
# if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'push' }}
# uses: codecov/codecov-action@v3