Skip to content

Merge pull request #256 from spacemeshos/dependabot/cargo/libc-0.2.154 #918

Merge pull request #256 from spacemeshos/dependabot/cargo/libc-0.2.154

Merge pull request #256 from spacemeshos/dependabot/cargo/libc-0.2.154 #918

Workflow file for this run

on:
pull_request:
push:
branches:
- main
tags:
- 'v*'
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@1.76
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace --all-features
test:
name: Test Suite
needs:
- check
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: [self-hosted, linux, x64, intel]
runner: self-hosted-linux-intel
- os: [self-hosted, linux, arm64]
rustflags: --cfg=aes_armv8
- os: [self-hosted, macos, arm64]
rustflags: --cfg=aes_armv8
- os: macos-13
toolchain: stable
- os: windows-2019
steps:
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@1.76
- if: matrix.runner == 'self-hosted-linux-intel'
run: sudo apt-get update && sudo apt-get install -y libpocl2 pocl-opencl-icd ocl-icd-opencl-dev
name: Install dependencies for testing openCL on Linux
- if: matrix.os == 'windows-2019'
name: Install dependencies for testing openCL on Windows
run: |
choco install -y wget unzip opencl-intel-cpu-runtime
wget https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v2023.04.17/OpenCL-SDK-v2023.04.17-Win-x64.zip
unzip -j OpenCL-SDK-v2023.04.17-Win-x64.zip OpenCL-SDK-v2023.04.17-Win-x64/lib/OpenCL.lib
- uses: Swatinem/rust-cache@v2
- name: Tests
run: cargo test --workspace --exclude scrypt-ocl
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Test scrypt-ocl crate
if: matrix.os != 'windows-2019'
run: cargo test -p scrypt-ocl -- --test-threads=1
env:
RUSTFLAGS: ${{ matrix.rustflags }}
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@1.76
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Annotate commit with clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --workspace
coverage:
runs-on: [self-hosted, linux, x64, intel]
steps:
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install opencl
run: sudo apt-get update && sudo apt-get install -y libpocl2 pocl-opencl-icd ocl-icd-opencl-dev
- uses: actions/checkout@v3
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@1.76
with:
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo llvm-cov
run: cargo llvm-cov --locked --lcov --output-path lcov.info --workspace --ignore-filename-regex "main.rs" -- --test-threads=1
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
build:
name: Build library
runs-on: ${{ matrix.os }}
needs:
- test
- fmt
- clippy
strategy:
fail-fast: false
matrix:
include:
- os: [self-hosted, linux, x64, intel]
runner: self-hosted-linux-intel
dylib: libpost.so
staticlib: libpost.a
artifact-name: linux
- os: [self-hosted, linux, arm64]
dylib: libpost.so
staticlib: libpost.a
rustflags: --cfg=aes_armv8
artifact-name: linux-arm64
- os: [self-hosted, macos, arm64]
dylib: libpost.dylib
staticlib: libpost.a
rustflags: --cfg=aes_armv8
artifact-name: macos-m1
- os: macos-13
dylib: libpost.dylib
staticlib: libpost.a
artifact-name: macos
- os: windows-2019
dylib: post.dll
staticlib: post.lib
artifact-name: windows
steps:
- if: matrix.runner == 'self-hosted-linux-intel'
run: sudo apt-get update && sudo apt-get install -y ocl-icd-opencl-dev
name: Install opencl
- if: matrix.os == 'windows-2019'
name: Install opencl
run: vcpkg install opencl
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@1.76
- uses: Swatinem/rust-cache@v2
with:
key: ${{ join( matrix.os, '-' ) }}
- if: matrix.os == 'windows-2019'
name: Download OpenCL.lib
run: |
choco install -y wget unzip
wget https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v2023.04.17/OpenCL-SDK-v2023.04.17-Win-x64.zip
unzip -j OpenCL-SDK-v2023.04.17-Win-x64.zip OpenCL-SDK-v2023.04.17-Win-x64/lib/OpenCL.lib
- name: Version suffix (for release only)
id: version
run: echo "suffix=${{ github.ref_type == 'tag' && '-' || ''}}${{ github.ref_type == 'tag' && github.ref || ''}}" >> $GITHUB_OUTPUT
- name: Build clib
run: cargo build -p post-cbindings --profile release-clib
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: libpost-${{ matrix.artifact-name }}${{ steps.version.output.suffix }}
path: |
ffi/post.h
target/release-clib/${{ matrix.dylib }}
target/release-clib/${{ matrix.staticlib }}
if-no-files-found: error
- name: Build profiler tool
run: cargo build -p profiler --release
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Archive profiler artifacts
uses: actions/upload-artifact@v3
with:
name: profiler-${{ matrix.artifact-name }}${{ steps.version.output.suffix }}
path: |
target/release/profiler${{ matrix.os == 'windows-2019' && '.exe' || '' }}
if-no-files-found: error
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build service
run: cargo build -p service --release
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Archive service artifacts
uses: actions/upload-artifact@v3
with:
name: service-${{ matrix.artifact-name }}${{ steps.version.output.suffix }}
path: |
target/release/service${{ matrix.os == 'windows-2019' && '.exe' || '' }}
if-no-files-found: error
release:
name: Publish release
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: List artifacts
run: ls -R ./artifacts
- name: Create a draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Pack artifacts
run: >
mkdir ./assets;
for dir in ./artifacts/*/; do
zip -o -j -r "./assets/$(basename "$dir")-$TAG.zip" "$dir";
done
env:
TAG: ${{ github.ref_name }}
- name: Upload Release Assets
run: gh release upload $TAG ./assets/*.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}