Skip to content

Commit

Permalink
chore(ci): refactoring benchmark workflow
Browse files Browse the repository at this point in the history
Adds actionlint configuration file.
Also install runner as a ubuntu user instead of root.
  • Loading branch information
soonum committed Nov 4, 2024
1 parent bc06ebd commit 6f72e6a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
self-hosted-runner:
# Labels of self-hosted runner in array of strings.
labels:
- m1mac
15 changes: 8 additions & 7 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ jobs:
with:
fetch-depth: 0

- name: Set up home
# "Install rust" step require root user to have a HOME directory which is not set.
- name: Get benchmark details
run: |
echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}"
{
echo "BENCH_DATE=$(date --iso-8601=seconds)";
echo "COMMIT_DATE=$(git --no-pager show -s --format=%cd --date=iso8601-strict ${{ github.sha }})";
echo "COMMIT_HASH=$(git describe --tags --dirty)";
} >> "${GITHUB_ENV}"
- name: Install build dependencies
run: |
Expand All @@ -77,14 +80,12 @@ jobs:
- name: Parse results
run: |
COMMIT_DATE="$(git --no-pager show -s --format=%cd --date=iso8601-strict ${{ github.sha }})"
COMMIT_HASH="$(git describe --tags --dirty)"
python3 ./ci/benchmark_parser.py target/criterion ${{ env.RESULTS_FILENAME }} \
--database concrete_fft \
--hardware "hpc7a.96xlarge" \
--project-version "${COMMIT_HASH}" \
--project-version "${{ env.COMMIT_HASH }}" \
--branch ${{ github.ref_name }} \
--commit-date "${COMMIT_DATE}" \
--commit-date "${{ env.COMMIT_DATE }}" \
--bench-date "${{ env.BENCH_DATE }}"
rm -rf target/criterion benchmarks_parameters/
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/ci_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Lint and check CI
name: CI Lint and Checks

on:
pull_request:

env:
ACTIONLINT_VERSION: 1.6.27

jobs:
lint-check:
name: Lint and checks
runs-on: ubuntu-latest
steps:
- name: Checkout tfhe-rs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Get actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) ${{ env.ACTIONLINT_VERSION }}
echo "f2ee6d561ce00fa93aab62a7791c1a0396ec7e8876b2a8f2057475816c550782 actionlint" > checksum
sha256sum -c checksum
ln -s "$(pwd)/actionlint" /usr/local/bin/
- name: Lint workflows
run: |
make lint_workflow
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ check_nvm_installed:
@source ~/.nvm/nvm.sh && nvm --version > /dev/null 2>&1 || \
( echo "Unable to locate Node. Run 'make install_node'" && exit 1 )

.PHONY: check_actionlint_installed # Check if actionlint workflow linter is installed
check_actionlint_installed:
@actionlint --version > /dev/null 2>&1 || \
( echo "Unable to locate actionlint. Try installing it: https://github.com/rhysd/actionlint/releases" && exit 1 )

.PHONY: fmt # Format rust code
fmt: install_rs_check_toolchain
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" fmt
Expand All @@ -86,6 +91,10 @@ fmt: install_rs_check_toolchain
check_fmt: install_rs_check_toolchain
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" fmt --check

.PHONY: lint_workflow # Run static linter on GitHub workflows
lint_workflow: check_actionlint_installed
@actionlint

.PHONY: clippy # Run clippy lints
clippy: install_rs_check_toolchain
RUSTFLAGS="$(RUSTFLAGS)" cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" clippy --all-targets \
Expand Down
1 change: 1 addition & 0 deletions ci/slab.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
region = "eu-west-1"
image_id = "ami-0f96f17e9f652c6ab"
instance_type = "hpc7a.96xlarge"
user = "ubuntu"

0 comments on commit 6f72e6a

Please sign in to comment.