nim-status/.github/workflows/test.yml

117 lines
3.8 KiB
YAML

name: Tests
on:
pull_request:
push:
branches:
- master
jobs:
tests:
env:
NPROC: 2
strategy:
fail-fast: false
matrix:
platform:
- {
icon: 🏁,
os: windows,
shell: msys2
}
- {
icon: 🍎,
os: macos,
shell: bash --noprofile --norc -eo pipefail
}
- {
icon: 🐧,
os: ubuntu,
shell: bash --noprofile --norc -eo pipefail
}
# Using a full matrix of static/shared linking has been useful in the
# past for catching edge cases, but none have been experienced in
# recent months so limit to static linking to reduce build and run
# times in this workflow. The full matrix can always be activated in a
# PR branch if it's suspected we're bumping into an edge case as
# experienced previously.
# pcre: [ true, false ]
# rln: [ true, false ]
# sqlcipher: [ true, false ]
# ssl: [ true, false ]
pcre: [ true ]
rln: [ true ]
sqlcipher: [ true ]
ssl: [ true ]
name: ${{ matrix.platform.icon }} - static linking - PCRE ${{ matrix.pcre }} | RLN ${{ matrix.rln }} | SQLCIPHER ${{ matrix.sqlcipher }} | SSL ${{ matrix.ssl }}
runs-on: ${{ matrix.platform.os }}-latest
defaults:
run:
shell: ${{ matrix.platform.shell }} {0}
steps:
- name: Install tools and libraries via Homebrew
if: matrix.platform.os == 'macos'
run: |
brew install coreutils gawk
rm -f /usr/local/opt/openssl
ln -s /usr/local/opt/openssl@1.1 /usr/local/opt/openssl
- uses: msys2/setup-msys2@v2
if: matrix.platform.os == 'windows'
with:
msystem: MINGW64
update: true
install: >
base-devel
git
unzip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-openssl
mingw-w64-x86_64-pcre
mingw-w64-x86_64-rust
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Calculate cache key from submodules tree
id: calc-cache-key
run: |
echo "::set-output name=hash::$(git submodule foreach --quiet --recursive 'git rev-parse $(git rev-parse --abbrev-ref HEAD)' | sha1sum | awk '{print $1}')"
- uses: actions/cache@v2
with:
path: |
vendor/nim-sqlcipher/lib
vendor/nim-waku/vendor/nim-nat-traversal/vendor/libnatpmp-upstream
vendor/nim-waku/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc
vendor/nim-waku/vendor/rln/target
vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ matrix.platform.os }}-${{ steps.calc-cache-key.outputs.hash }}-sqlcipher_static-${{ matrix.sqlcipher }}
- name: Install and build dependencies
run: |
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" V=1 update
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" V=1 deps
- name: Build and run tests
# using `llvm-ar` instead of `ar` on macOS is a workaround for:
# https://github.com/nim-lang/Nim/issues/15589
run: |
if [[ ${{ matrix.platform.os }} = macos ]]; then
mkdir -p "${HOME}/.local/bin"
ln -f -s /usr/local/Cellar/llvm/*/bin/llvm-ar "${HOME}/.local/bin/ar"
export PATH="${HOME}/.local/bin:${PATH}"
fi
make \
NIMFLAGS="--parallelBuild:${NPROC}" \
PCRE_STATIC=${{ matrix.pcre }} \
RLN_STATIC=${{ matrix.rln }} \
SQLCIPHER_STATIC=${{ matrix.sqlcipher }} \
SSL_STATIC=${{ matrix.ssl }} \
V=1 \
test