Skip to content

Commit

Permalink
Refactor GitHub Workflows (IntersectMBO#6124)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeme-wana authored and v0d1ch committed Dec 6, 2024
1 parent 96d3df8 commit 08a53cc
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
name: Check Changelog
# This job enforces that: either some changelog.d/** files were added by the
# PR, or the PR has the "No Changelog Required" label.

name: "🏷️ Changelog Label"

on:
pull_request:
types: [ opened, synchronize, labeled, unlabeled ]
types: [ opened, reopened, synchronize, labeled, unlabeled ]

jobs:
check-changelog:

check:
name: Check
runs-on: [ubuntu-latest]
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@main

- name: Find Changed Files in changelog.d
- name: Find Changed Files
id: changed-files
uses: tj-actions/changed-files@v44
uses: tj-actions/changed-files@main
with:
files: '**/changelog.d/**'

- name: Enforce New File or 'No Changelog Required' Label
uses: actions/github-script@v7
# don't require changelogs for draft PRs
- name: Enforce Label
uses: actions/github-script@main
# Don't require changelogs for draft PRs
if: github.event.pull_request.draft == false
with:
script: |
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/cost-model-bench.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/cost-model-benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow runs the cost model benchmark and uploads the results as a
# GitHub artifact.

name: "💰 Cost Model Benchmark"

on:
workflow_dispatch:
inputs:
entra-bench-args:
description: 'extra argument(s) to pass to the cost-model-budgeting-bench command'
default: ''
type: string

jobs:
run:
name: Run
runs-on: [self-hosted, plutus-benchmark]
steps:
- name: Checkout
uses: actions/checkout@main

- name: Run Benchmark
run: nix --accept-flake-config run .#cost-model-budgeting-bench -- --csv results.csv ${{ inputs.entra-bench-args }}

- name: Upload Results
uses: actions/upload-artifact@main
with:
name: results
path: results.csv
if-no-files-found: error
4 changes: 2 additions & 2 deletions .github/workflows/docusaurus-site.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow builds and publishes the Docusaurus site to:
# https://intersectmbo.github.io/plutus/docs

name: "🦕 Deploy Docusaurus Site"
name: "🦕 Docusaurus Site"

on:
workflow_dispatch:
Expand All @@ -20,7 +20,7 @@ jobs:

- name: Build Site
working-directory: doc/docusaurus
run: nix develop --accept-flake-config --command bash -c 'yarn && yarn build'
run: nix develop --no-warn-dirty --accept-flake-config --command bash -c 'yarn && yarn build'

- name: Deploy Site
uses: JamesIves/github-pages-deploy-action@v4.6.1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/haddock-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# And optionally to:
# https://intersectmbo.github.io/plutus/haddock/latest

name: "📜 Deploy Haddock Site"
name: "📜 Haddock Site"

on:
workflow_dispatch:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Build Site
run: |
nix develop --accept-flake-config --command ./scripts/combined-haddock.sh _haddock all
nix develop --no-warn-dirty --accept-flake-config --command ./scripts/combined-haddock.sh _haddock all
- name: Deploy Site
uses: JamesIves/github-pages-deploy-action@v4.6.1
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/longitudinal-benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Longitudinal Benchmarks
#
# This workflow will run the benchmarks defined in the environment variable BENCHMARKS.
# It will collect and aggreate the benchmark output, format it and feed it to github-action-benchmark.
# This workflow runs the benchmarks defined in the environment variable BENCHMARKS.
# It will collect and aggreate the benchmark output, format it and feed it to the
# github-action-benchmark action.
#
# The benchmark charts are live at https://input-output-hk.github.io/plutus/dev/bench
# The benchmark data is available at https://input-output-hk.github.io/plutus/dev/bench/data.js
# The benchmark charts are live at https://intersectmbo.github.io/plutus/dev/bench
# The benchmark data is available at https://intersectmbo.github.io/plutus/dev/bench/data.js
#
# This is a performance regression check that is run on every push master.

name: Longitudinal Benchmarks
name: "🩺 Longitudinal Benchmark"

on:
push:
Expand All @@ -20,28 +21,26 @@ permissions:
contents: write

jobs:
longitudinal-benchmarks:
name: Performance regression check
run:
name: Run
runs-on: [self-hosted, plutus-benchmark]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Checkout
uses: actions/checkout@main

- name: Run benchmarks
- name: Run Benchmarks
env:
BENCHMARKS: "validation validation-decode nofib marlowe"
run: nix develop --no-warn-dirty --accept-flake-config --command bash ./scripts/run-longitudinal-benchmarks.sh

# We need this otherwise the next step (Store benchmark result) will fail with:
# We need this otherwise the next step will fail with:
# `pre-commit` not found. Did you forget to activate your virtualenv?
# This is because github-action-benchmark will call git commit outside nix develop.
- name: Disable Git Hooks
run: git config core.hooksPath no-hooks

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1.20.3
- name: Deploy Results
uses: benchmark-action/github-action-benchmark@main
with:
name: Plutus Benchmarks
tool: 'customSmallerIsBetter'
Expand All @@ -51,9 +50,10 @@ jobs:
auto-push: true
# Enable alert commit comment
comment-on-alert: true
# Mention @IntersectMBO/plutus-core in the commit comment
# Mention @IntersectMBO/plutus-core in the commit comment so that the
# team is notified via GitHub.
alert-comment-cc-users: '@IntersectMBO/plutus-core'
# Percentage value like "110%".
# It is a ratio indicating how worse the current benchmark result is.
# For example, if we now get 110 ns/iter and previously got 100 ns/iter, it gets 110% worse.
# For example, if we now get 110 ns/iter and previously got 100 ns/iter, it got 10% worse.
# In this case we alert if it gets 5% worse.
alert-threshold: '105%'
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: Benchmark
# This workflows checks for comments in PRs. If the comment has this format:
# /benchmark NAME
# Then this action will run the benchmark with the given NAME, first agains
# the current branch and then comparing the results against the master branch.

name: "🚀 Manual Benchmark"

on:
issue_comment:
types: [created]

jobs:
benchmark:
run:
name: Run
runs-on: [self-hosted, plutus-benchmark]

permissions:
pull-requests: write

Expand All @@ -16,13 +22,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@main
with:
# We need at least one commit before master to compare against
fetch-depth: 5

- name: React with Rocket
uses: actions/github-script@v7
- name: React With Rocket
uses: actions/github-script@main
with:
script: |
github.rest.reactions.createForIssueComment({
Expand All @@ -34,7 +40,7 @@ jobs:
- name: Extract Benchmark Name
id: extract-benchmark
uses: actions/github-script@v7
uses: actions/github-script@main
with:
script: |
const regex = /^\/benchmark\s*(.*?)\s*$/;
Expand All @@ -45,9 +51,9 @@ jobs:
else
core.setFailed(`Unable to extract benchmark name from ${comment}`);
- name: Extract Comment Branch
- name: Extract Branch Name
id: extract-branch
uses: actions/github-script@v7
uses: actions/github-script@main
with:
script: |
async function isPullRequest() {
Expand Down Expand Up @@ -90,8 +96,8 @@ jobs:
core.setFailed(`Error: ${error}`);
}
- name: Publish Link To Action Run
uses: actions/github-script@v7
- name: Publish GH Action Link
uses: actions/github-script@main
with:
script: |
async function getJobUrl() {
Expand All @@ -105,7 +111,7 @@ jobs:
body: `Click [here](${await getJobUrl()}) to check the status of your benchmark.`
});
- name: Run
- name: Run Benchmark
run: |
nix develop --no-warn-dirty --accept-flake-config --command bash ./scripts/ci-plutus-benchmark.sh
env:
Expand All @@ -115,7 +121,7 @@ jobs:


- name: Publish Results
uses: actions/github-script@v7
uses: actions/github-script@main
with:
script: |
const fs = require("fs");
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/metatheory-site.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# This workflow publishes the Agda metatheory site to:
# https://intersectmbo.github.io/plutus/metatheory/$version
# Where $version should be a release version tag.
# Optionally the $version branch can also be deployed to:
# https://intersectmbo.github.io/plutus/metatheory/latest
# This workflow builds and publishes the metatheory site to:
# https://intersectmbo.github.io/plutus/metatheory/$version
# And optionally to:
# https://intersectmbo.github.io/plutus/metatheory/latest

name: "🔮 Deploy Metatheory Site"
name: "🔮 Metatheory Site"

on:
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Nightly Test Suite
# This workflow runs the nightly plutus-core-test and plutus-ir-test test suite.

name: "🌘 Nightly Testsuite"

on:
schedule:
- cron: 0 0 * * * # daily at midnight
- cron: 0 0 * * * # Daily at midnight

workflow_dispatch: # or manually dispatch the job
workflow_dispatch: # Or manually dispatch the job
inputs:
hedgehog-tests:
description: Numer of tests to run (--hedgehog-tests XXXXX)
Expand All @@ -15,19 +17,20 @@ env:
HEDGEHOG_TESTS: ${{ github.event.inputs.hedgehog-tests || 100000 }}

jobs:
nightly-test-suite:
runs-on: [self-hosted, plutus-shared]
run:
name: Run
runs-on: [self-hosted, plutus-benchmark]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@main

- name: plutus-core-nightly
- name: Run Plutus Core Test
run: |
pushd plutus-core
nix run --no-warn-dirty --accept-flake-config .#plutus-core-test -- --hedgehog-tests $HEDGEHOG_TESTS
popd
- name: plutus-ir-nightly
- name: Run Plutus IR Test
run: |
pushd plutus-core
nix run --no-warn-dirty --accept-flake-config .#plutus-ir-test -- --hedgehog-tests $HEDGEHOG_TESTS
Expand Down
Loading

0 comments on commit 08a53cc

Please sign in to comment.