parallel tests and faster runners #92
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
save: | |
description: 'Save Filecoin parameters' | |
required: false | |
default: 'false' | |
publish: | |
description: 'Publish the static library' | |
required: false | |
default: 'false' | |
run-leak-detector: | |
description: 'Run the CGO leak detector' | |
required: false | |
default: 'false' | |
ref: | |
description: 'The ref to build' | |
required: false | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
permissions: | |
contents: read | |
# Can we apply these to the entire workflow? | |
env: | |
# Build the kernel only for the single architecture. This should reduce | |
# the overall compile-time significantly. | |
EC_GPU_CUDA_NVCC_ARGS: --fatbin --gpu-architecture=sm_75 --generate-code=arch=compute_75,code=sm_75 | |
BELLMAN_CUDA_NVCC_ARGS: --fatbin --gpu-architecture=sm_75 --generate-code=arch=compute_75,code=sm_75 | |
NEPTUNE_CUDA_NVCC_ARGS: --fatbin --gpu-architecture=sm_75 --generate-code=arch=compute_75,code=sm_75 | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
check: | |
name: Check code style and run linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/configure-environment | |
- if: github.event.inputs.ref != '' | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: ${{ github.event.inputs.ref }} | |
- name: Run shellcheck | |
run: shellcheck ./install-filcrypto | |
- name: Run cargo fmt | |
run: | | |
rustup component add rustfmt | |
cargo fmt --manifest-path ./rust/Cargo.toml --all -- --check | |
- name: Run cargo clippy | |
run: cd rust && cargo clippy --all-targets --features blst-portable,opencl -- -D warnings | |
- name: Run go fmt | |
# `! go fmt ./... 2>&1 | read"` doesn't work, this one does, thanks | |
# https://carsonip.me/posts/go-fmt-and-ci/ | |
run: | | |
output=$(go fmt ./...) | |
echo "${output}" | |
test -z "${output}" | |
- name: Run various linters | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.0 | |
make go-lint | |
cgo-bindings: | |
name: Build and test CGO bindings (${{ matrix.runner.name }}) | |
runs-on: ${{ matrix.runner.machine }} | |
strategy: | |
matrix: | |
runner: | |
- name: "linux-x86_64" | |
machine: ["self-hosted", "linux", "x64", "4xlarge"] | |
- name: "linux-arm64" | |
machine: ["self-hosted", "linux", "arm64", "2xlarge"] | |
- name: "macos-latest" | |
machine: 'macos-latest' | |
fail-fast: false | |
steps: | |
- run: echo "Running on $RUNNER_OS $RUNNER_ARCH" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/configure-environment | |
- if: github.event.inputs.ref != '' | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: ${{ github.event.inputs.ref }} | |
- if: runner.os == 'macOS' | |
run: cd rust && cargo fetch | |
- name: Build project | |
run: make | |
- name: Build project without CGO | |
run: env CGO_ENABLED=0 go build . | |
- if: runner.os == 'Linux' | |
uses: actions/cache/restore@v3 | |
with: | |
key: v28-proof-params-${{ runner.os }}-${{ runner.arch }} | |
path: | | |
./filecoin-proof-parameters | |
- if: runner.os == 'Linux' | |
name: Obtain Filecoin parameters | |
run: | | |
DIR=$(pwd) | |
cd $(mktemp -d) | |
go install github.com/filecoin-project/go-paramfetch/paramfetch@latest | |
$GOPATH/bin/paramfetch 2048 "${DIR}/parameters.json" "${DIR}/srs-inner-product.json" | |
- if: runner.os == 'Linux' && (github.event == 'push' || github.event.inputs.save == 'true') | |
uses: actions/cache/save@v3 | |
with: | |
key: v28-proof-params-${{ runner.os }}-${{ runner.arch }} | |
path: | | |
./filecoin-proof-parameters | |
- if: runner.os == 'Linux' | |
run: cd rust && rustup target add wasm32-unknown-unknown | |
- if: github.event.inputs.run-leak-detector == 'true' | |
run: make cgo-leakdetect | |
- if: runner.os == 'Linux' | |
run: cd rust && FIL_PROOFS_PARAMETER_CACHE="${GITHUB_WORKSPACE}/filecoin-proof-parameters/" RUST_LOG=info cargo test --all --release && cd .. | |
- if: runner.os == 'Linux' | |
run: GOEXPERIMENT=cgocheck2 RUST_LOG=info go test -timeout 60m | |
- if: runner.os == 'macOS' | |
name: Build project and tests, but don't actually run the tests (used to verify that build/link works with Darwin) | |
run: GOEXPERIMENT=cgocheck2 RUST_LOG=info go test -run=^$ | |
supraseal: | |
name: Build with CUDA supraseal | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/configure-environment | |
- if: github.event.inputs.ref != '' | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: ${{ github.event.inputs.ref }} | |
- name: Build project with `FFI_USE_CUDA_SUPRASEAL=1` | |
run: FFI_BUILD_FROM_SOURCE=1 FFI_USE_CUDA_SUPRASEAL=1 make |