Skip to content

Commit

Permalink
refactor ci
Browse files Browse the repository at this point in the history
  • Loading branch information
BourgerieQuentin committed Nov 4, 2024
1 parent ee993c2 commit 8a5a235
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 419 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
name: Action Pin
name: check action compliance

on:
pull_request:
paths:
- .github/workflows/**
push:
branches:
- main
- 'release/*'

jobs:
check-action-pin:
action-pin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@0901cf7b71c7ea6261ec69a3dc2bd3f9264f893e # v3.0.12
with:
allowlist: |
slsa-framework/slsa-github-generator
action-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: actionlint
uses: raven-actions/actionlint@01fce4f43a270a612932cb1c64d40505a029f821 # v2.0.0
16 changes: 0 additions & 16 deletions .github/workflows/actionlint.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/check_commit_signature.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Check commit and PR compliance
name: Check commit message compliance
name: check commit compliance
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- 'main'
- 'release/*'

jobs:
check-commit-pr:
name: Check commit and PR
runs-on: ubuntu-20.04
format:
runs-on: ubuntu-latest
steps:
- name: Check first line
uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee # v2.0.0
Expand All @@ -19,3 +20,18 @@ jobs:
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true

signatures:
runs-on: ubuntu-latest
steps:
- name: Check commit signatures
uses: 1Password/check-signed-commits-action@ed2885f3ed2577a4f5d3c3fe895432a557d23d52

linelint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Linelint
uses: fernandrone/[email protected]
id: linelint
142 changes: 0 additions & 142 deletions .github/workflows/compiler_benchmark.yml

This file was deleted.

127 changes: 127 additions & 0 deletions .github/workflows/concrete_compiler_benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: concrete-compiler benchmark linux-cpu

on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/concrete_compiler_benchmark.yml
- compilers/**
- backends/**
- tools/**
push:
branches:
- 'main'
- 'release/*'

env:
DOCKER_IMAGE_TEST: ghcr.io/zama-ai/concrete-compiler
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

jobs:
setup-instance:
name: Setup instance
runs-on: ubuntu-latest
outputs:
runner-name: ${{ steps.start-instance.outputs.label }}
steps:
- name: Start instance
id: start-instance
uses: zama-ai/slab-github-runner@447a2d0fd2d1a9d647aa0d0723a6e9255372f261
with:
mode: start
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL }}
job-secret: ${{ secrets.JOB_SECRET }}
backend: aws
profile: cpu-test

build-and-run-benchmarks:
name: Build and run concrete-compiler benchmarks
needs: setup-instance
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
steps:
- name: Checkout concrete
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
fetch-depth: 0
- name: Set up home
# "Install rust" step require root user to have a HOME directory which is not set.
run: |
echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}"
- name: Setup rust toolchain for concrete-cpu
uses: ./.github/workflows/setup_rust_toolchain_for_concrete_cpu
- name: Build compiler benchmarks
run: |
set -e
git config --global --add safe.directory '*'
cd compilers/concrete-compiler/compiler
make BINDINGS_PYTHON_ENABLED=OFF build-benchmarks
- name: Slack Notification
if: ${{ failure() }} && github.ref == 'refs/heads/main'
continue-on-error: true
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Build compiler benchmark finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
- name: Run compiler benchmarks
run: |
set -e
cd compilers/concrete-compiler/compiler
make run-cpu-benchmarks
- name: Upload raw results artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: compiler-benchmarks-result
path: compilers/concrete-compiler/compiler/benchmarks_results.json

parse-and-send-results:
name: Parse and send results
needs: [setup-instance, build-and-run-benchmarks]
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
steps:
- name: Download concrete-compiler python-bindings
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: concrete-compiler-python-bindings
path: compiler-benchmarks-result
- name: Parse results
shell: bash
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 compilers/concrete-compiler/compiler/benchmarks_results.json parsed_benchmark_results.json \
--database compiler_benchmarks \
--hardware "hpc7a.96xlarge" \
--project-version ${COMMIT_HASH} \
--branch ${{ github.ref_name }} \
--commit-date ${COMMIT_DATE} \
--bench-date "$(date --iso-8601=seconds)" \
--throughput
- name: Upload parsed results artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: compiler-benchmarks-result
path: parsed_benchmark_results.json
- name: Checkout Slab repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: zama-ai/slab
path: slab
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- name: Send data to Slab
shell: bash
run: |
echo "Computing HMac on downloaded artifact"
SIGNATURE="$(slab/scripts/hmac_calculator.sh parsed_benchmark_results.json '${{ secrets.JOB_SECRET }}')"
echo "Sending results to Slab..."
curl -v -k \
-H "Content-Type: application/json" \
-H "X-Slab-Repository: ${{ github.repository }}" \
-H "X-Slab-Command: store_data" \
-H "X-Hub-Signature-256: sha256=${SIGNATURE}" \
-d @parsed_benchmark_results.json \
${{ secrets.SLAB_URL }}
Loading

0 comments on commit 8a5a235

Please sign in to comment.