mirror of
https://github.com/zama-ai/concrete.git
synced 2026-01-13 14:58:01 -05:00
129 lines
3.8 KiB
YAML
129 lines
3.8 KiB
YAML
name: Optimizer - Tests
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
secrets:
|
|
CONCRETE_CI_SSH_PRIVATE:
|
|
required: true
|
|
CONCRETE_ACTIONS_TOKEN:
|
|
required: true
|
|
|
|
concurrency:
|
|
group: optimizer-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
jobs:
|
|
tests:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04, macos-11]
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: "Setup"
|
|
uses: ./.github/workflows/optimizer_setup
|
|
with:
|
|
ssh_private_key: ${{ secrets.CONCRETE_CI_SSH_PRIVATE }}
|
|
|
|
- name: Formatting
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo fmt --check
|
|
|
|
- name: Build
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo build --release --all-targets
|
|
|
|
- name: Lint
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo clippy --release --all-targets
|
|
|
|
- name: Tests
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo test --release --no-fail-fast --all-targets
|
|
make -C concrete-optimizer-cpp test-ci
|
|
|
|
benchmarks:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: "Setup"
|
|
uses: ./.github/workflows/optimizer_setup
|
|
with:
|
|
ssh_private_key: ${{ secrets.CONCRETE_CI_SSH_PRIVATE }}
|
|
|
|
- name: Run benchmark
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo bench -p v0-parameters -- --output-format bencher | tee bench_result.txt
|
|
|
|
- name: Download PR base benchmark data
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
# for artifacts restrictions see https://github.com/actions/download-artifact/issues/3
|
|
# for cache restrictions see https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
|
|
# and https://github.com/actions/cache/issues/692
|
|
uses: dawidd6/action-download-artifact@v2
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
workflow_conclusion: success
|
|
commit: ${{ github.event.pull_request.base.sha }}
|
|
name: ${{ runner.os }}-benchmark
|
|
if_no_artifact_found: warn
|
|
path: ./benchmark
|
|
|
|
- name: Save benchmark result to file
|
|
uses: benchmark-action/github-action-benchmark@v1
|
|
with:
|
|
tool: 'cargo'
|
|
output-file-path: ./compilers/concrete-optimizer/bench_result.txt
|
|
external-data-json-path: ./benchmark/benchmark-data.json
|
|
# GitHub API token to make a commit comment
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
# Enable alert commit comment
|
|
comment-always: true
|
|
|
|
- name: Upload benchmark data
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
path: ./compilers/concrete-optimizer/benchmark
|
|
name: ${{ runner.os }}-benchmark
|
|
|
|
nightly-check:
|
|
runs-on: ubuntu-20.04
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Rust install
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
override: true
|
|
components: rustfmt, clippy
|
|
# A SSH private key is required as some dependencies are from private repos
|
|
- name: Set ssh keys
|
|
uses: webfactory/ssh-agent@v0.7.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.CONCRETE_CI_SSH_PRIVATE }}
|
|
- name: Formatting
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo fmt --check
|
|
|
|
- name: Lint
|
|
run: |
|
|
cd compilers/concrete-optimizer
|
|
cargo clippy --release --all-targets
|
|
|