Skip to content

Commit

Permalink
reuse devcontainer image in github actions
Browse files Browse the repository at this point in the history
This is needed to run benchmarking tests in CI using the same `valgrind` binaries we install in the devcontainer.
Also moved the cache steps to a common action to avoid duplication.
  • Loading branch information
OmarTawfik committed Jul 30, 2024
1 parent 39955cd commit 2f26218
Show file tree
Hide file tree
Showing 12 changed files with 350 additions and 355 deletions.
18 changes: 18 additions & 0 deletions .github/actions/cache/restore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "cache/restore"

runs:
using: "composite"
steps:
- name: "Restore Cache"
uses: "actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9"
with:
# __SLANG_CI_CACHE_PATHS__ (keep in sync)
key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}"
path: |
~/.cache/hermit/
~/.local/share/virtualenvs/
.hermit/
restore-keys: |
cache-${{ github.ref_name }}-
cache-main-
cache-
18 changes: 18 additions & 0 deletions .github/actions/cache/save/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "cache/save"

runs:
using: "composite"
steps:
- name: "Repossess files from devcontainer user"
shell: "bash"
run: "sudo chown -R $USER:$USER $GITHUB_WORKSPACE"

- name: "Save Cache"
uses: "actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9"
with:
# __SLANG_CI_CACHE_PATHS__ (keep in sync)
key: "cache-${{ github.ref_name }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('package-lock.json') }}"
path: |
~/.cache/hermit/
~/.local/share/virtualenvs/
.hermit/
56 changes: 0 additions & 56 deletions .github/workflows/_jobs_ci.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/_jobs_github_pages.yml

This file was deleted.

100 changes: 0 additions & 100 deletions .github/workflows/_jobs_publish.yml

This file was deleted.

76 changes: 0 additions & 76 deletions .github/workflows/_jobs_sanctuary.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "benchmark"

on:
# Run using manual triggers from GitHub UI:
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch: {}

# Run on pushes to any branch:
push: {}

# Queue up benchmark workflows for the same branch, so that results are reported in order:
concurrency:
group: "${{ github.workflow }}-${{ github.ref_name }}"
cancel-in-progress: false

jobs:
run:
runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync)

# Only run on the main repo (not forks):
if: "${{ github.repository == 'NomicFoundation/slang' }}"

steps:
- name: "Checkout Repository"
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332"

- name: "Restore Cache"
uses: "./.github/actions/cache/restore"

- name: "infra setup cargo"
uses: "./.devcontainer"
with:
entrypoint: "./scripts/bin/infra"
args: "setup cargo"

- name: "infra perf benchmark"
uses: "./.devcontainer"
with:
entrypoint: "./scripts/bin/infra"
args: "perf benchmark"
env:
BENCHER_API_TOKEN: "${{ secrets.BENCHER_API_TOKEN }}"
Loading

0 comments on commit 2f26218

Please sign in to comment.