Skip to content

Commit

Permalink
build: Fix passing of nixHash to QC, run benchmarks as part of main b…
Browse files Browse the repository at this point in the history
…uild (#2042)

Co-authored-by: Adam Washington <[email protected]>
  • Loading branch information
trisyoungs and rprospero authored Jan 22, 2025
1 parent 77059ed commit 253c974
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 72 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/_build_and_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ on:
nixHash:
type: string
required: true
benchmark:
type: boolean
default: false
publishBenchmarks:
type: boolean
default: false

jobs:

Expand Down Expand Up @@ -67,6 +73,8 @@ jobs:
target: ${{ matrix.target }}
currentVersion: ${{ inputs.currentVersion }}
nixHash: ${{ inputs.nixHash }}
benchmark: ${{ inputs.benchmark }}
publishBenchmarks: ${{ inputs.publishBenchmarks }}

Package:
needs: Build
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/_qc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Quality Control

on:
workflow_call:
inputs:
nixHash:
type: string
required: true

jobs:

Expand All @@ -19,6 +23,8 @@ jobs:

- name: Code Formatting
uses: "./.github/workflows/qc"
with:
nixHash: ${{ inputs.nixHash }}

ConventionalCommits:
if: github.event_name == 'pull_request'
Expand Down
63 changes: 0 additions & 63 deletions .github/workflows/benchmark.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ inputs:
nixHash:
type: string
default: 'UNKNOWN'
benchmark:
type: boolean
default: false
publishBenchmarks:
type: boolean
default: false

runs:
using: "composite"
Expand All @@ -35,6 +41,8 @@ runs:
cacheOnly: ${{ inputs.cacheOnly }}
currentVersion: ${{ inputs.currentVersion }}
nixHash: ${{ inputs.nixHash }}
benchmark: ${{ inputs.benchmark && inputs.target == 'dissolve' }}
publishBenchmarks: ${{ inputs.publishBenchmarks && inputs.target == 'dissolve' }}

- name: Build (OSX)
if: runner.os == 'MacOS'
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/build/linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ inputs:
nixHash:
type: string
required: true
benchmark:
type: boolean
default: false
publishBenchmarks:
type: boolean
default: false

runs:
using: "composite"
Expand Down Expand Up @@ -105,6 +111,31 @@ runs:
mkdir packages-binary
cp -v binary packages-binary/${{ inputs.target }}-${{ inputs.currentVersion }}
- name: Run benchmarks
if: inputs.benchmark == 'true'
shell: bash
run: |
set -ex
export LD_LIBRARY_PATH=`pwd`/build/onetbb/lib
nix build -L .#benchmarks
rm result
nix run -L .#benchmarks > all_benchmark_results.json
cat all_benchmark_results.json
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
if: inputs.publishBenchmarks == 'true' && inputs.benchmark == 'true'
with:
tool: 'googlecpp'
output-file-path: all_benchmark_results.json
github-token: ${{ github.token }}
auto-push: true
comment-on-alert: true
alert-threshold: '200%'
alert-comment-cc-users: '@disorderedmaterials/dissolve-devs'

- name: Tidy nix Store
if: ${{ inputs.cacheOnly == 'true' }}
shell: bash
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ on:
branches:
- 'develop'
paths-ignore:
- '.github/workflows/benchmark.yml'
- '.github/workflows/cacheConan.yml'
- '.github/workflows/cacheNix.yml'
- '.github/workflows/issues.yml'
- '.github/workflows/pr.yml'
- '.github/workflows/release.yml'
- '.github/workflows/web**'
- '.github/ISSUE_TEMPLATE/**'
- 'web/**'
- 'README.md'

jobs:
Expand All @@ -27,16 +24,21 @@ jobs:
QC:
needs: [Checkout]
uses: "./.github/workflows/_qc.yml"
with:
nixHash: ${{ needs.Checkout.outputs.nixHash }}

BuildAndPackage:
needs: [Checkout]
uses: "./.github/workflows/_build_and_package.yml"
with:
benchmark: true
publishBenchmarks: true
currentVersion: ${{ needs.Checkout.outputs.currentVersion }}
qtVersion: ${{ needs.Checkout.outputs.qtVersion }}
antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }}
conanHash: ${{ needs.Checkout.outputs.conanHash }}
nixHash: ${{ needs.Checkout.outputs.nixHash }}
secrets: inherit

Web:
needs: [Checkout]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ on:
branches:
- '*'
paths-ignore:
- '.github/workflows/benchmark.yml'
- '.github/workflows/cacheConan.yml'
- '.github/workflows/cacheNix.yml'
- '.github/workflows/continuous.yml'
- '.github/workflows/issues.yml'
- '.github/workflows/release.yml'
- '.github/workflows/web**'
- '.github/ISSUE_TEMPLATE/**'
- 'web/**'
- 'README.md'

jobs:
Expand All @@ -27,11 +24,14 @@ jobs:
QC:
needs: [Checkout]
uses: "./.github/workflows/_qc.yml"
with:
nixHash: ${{ needs.Checkout.outputs.nixHash }}

BuildAndPackage:
needs: [Checkout]
uses: "./.github/workflows/_build_and_package.yml"
with:
benchmark: false
currentVersion: ${{ needs.Checkout.outputs.currentVersion }}
qtVersion: ${{ needs.Checkout.outputs.qtVersion }}
antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/qc/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
name: Quality Control
description: Run quality control checks over the source code

inputs:
nixHash:
type: string
required: true

runs:
using: "composite"
Expand All @@ -14,7 +20,7 @@ runs:
id: nix-cache
with:
path: /tmp/nixcache
key: ${{ runner.os }}-${{ env.nixHash }}-nix-cache
key: ${{ runner.os }}-${{ inputs.nixHash }}-nix-cache

- name: Import Nix Store Cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
Expand Down
5 changes: 3 additions & 2 deletions changeversion
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,16 @@ do
;;
q) git cliff --bumped-version
;;
b) BUMPED=$(git cliff --bumped-version)
echo "BUMPED = ${BUMPED}"
b) CURRENT=$(GetAuthoritativeVersion)
BUMPED=$(git cliff --bumped-version)
if [ "${BUMPED}x" == "x" ]
then
echo "Error: Failed to auto-bump version."
exit 1
fi
SetCodeVersion ${BUMPED}
SetWebReleaseInfo ${BUMPED}
echo "Version auto-bumped to ${BUMPED} (from ${CURRENT})"
;;
l) git cliff --bump -u
;;
Expand Down

0 comments on commit 253c974

Please sign in to comment.