Skip to content

Commit a38770d

Browse files
authored
github/workflow updates (#109)
1 parent 3d2b1e0 commit a38770d

15 files changed

+197
-32
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# To workaroud https://github.com/actions/first-interaction/issues/10 in a secure way,
2+
# we take the following steps to generate and comment a performance benchmark result:
3+
# 1. first "performance tracking" workflow will generate the benchmark results in an unprivileged environment triggered on `pull_request` event
4+
# 2. then this "performance tracking (comment)" workflow will show the result to us as a PR comment in a privileged environment
5+
# Note that this workflow can only be modifed by getting checked-in to the default branch
6+
# and thus is secure even though this workflow is granted with write permissions, etc.
7+
# xref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
8+
9+
name: Performance tracking (comment)
10+
11+
on:
12+
workflow_run:
13+
workflows:
14+
- performance tracking
15+
types:
16+
- completed
17+
18+
jobs:
19+
comment:
20+
runs-on: ubuntu-latest
21+
#runs-on: self-hosted
22+
if: >
23+
${{ github.event.workflow_run.event == 'pull_request' &&
24+
github.event.workflow_run.conclusion == 'success' }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
# restore records from the artifacts
29+
- uses: dawidd6/action-download-artifact@v3
30+
with:
31+
workflow: benchmark.yml
32+
name: performance-tracking
33+
workflow_conclusion: success
34+
- name: output benchmark result
35+
id: output-result-markdown
36+
run: |
37+
echo ::set-output name=body::$(cat ./benchmark-result.artifact)
38+
- name: output pull request number
39+
id: output-pull-request-number
40+
run: |
41+
echo ::set-output name=body::$(cat ./pull-request-number.artifact)
42+
43+
# check if the previous comment exists
44+
- name: find comment
45+
uses: peter-evans/find-comment@v3
46+
id: fc
47+
with:
48+
issue-number: ${{ steps.output-pull-request-number.outputs.body }}
49+
comment-author: 'github-actions[bot]'
50+
body-includes: Benchmark Result
51+
52+
# create/update comment
53+
- name: create comment
54+
if: ${{ steps.fc.outputs.comment-id == 0 }}
55+
uses: peter-evans/create-or-update-comment@v4
56+
with:
57+
issue-number: ${{ steps.output-pull-request-number.outputs.body }}
58+
body: ${{ steps.output-result-markdown.outputs.body }}
59+
- name: update comment
60+
if: ${{ steps.fc.outputs.comment-id != 0 }}
61+
uses: peter-evans/create-or-update-comment@v4
62+
with:
63+
comment-id: ${{ steps.fc.outputs.comment-id }}
64+
body: ${{ steps.output-result-markdown.outputs.body }}

.github/workflows/benchmark.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Performance tracking
2+
on:
3+
pull_request:
4+
5+
env:
6+
PYTHON: ~
7+
8+
jobs:
9+
performance-tracking:
10+
runs-on: ubuntu-latest
11+
#runs-on: self-hosted
12+
steps:
13+
# setup
14+
- uses: actions/checkout@v4
15+
- uses: julia-actions/setup-julia@latest
16+
with:
17+
version: 'nightly'
18+
- uses: julia-actions/julia-buildpkg@latest
19+
- name: install dependencies
20+
run: julia -e 'using Pkg; pkg"add PkgBenchmark [email protected]"'
21+
22+
# run the benchmark suite
23+
- name: run benchmarks
24+
run: |
25+
julia -e '
26+
using BenchmarkCI
27+
BenchmarkCI.judge()
28+
BenchmarkCI.displayjudgement()
29+
'
30+
31+
# generate and record the benchmark result as markdown
32+
- name: generate benchmark result
33+
run: |
34+
body=$(julia -e '
35+
using BenchmarkCI
36+
37+
let
38+
judgement = BenchmarkCI._loadjudge(BenchmarkCI.DEFAULT_WORKSPACE)
39+
title = "Benchmark Result"
40+
ciresult = BenchmarkCI.CIResult(; judgement, title)
41+
BenchmarkCI.printcommentmd(stdout::IO, ciresult)
42+
end
43+
')
44+
body="${body//'%'/'%25'}"
45+
body="${body//$'\n'/'%0A'}"
46+
body="${body//$'\r'/'%0D'}"
47+
echo $body > ./benchmark-result.artifact
48+
49+
# record the pull request number
50+
- name: record pull request number
51+
run: echo ${{ github.event.pull_request.number }} > ./pull-request-number.artifact
52+
53+
# save as artifacts (performance tracking (comment) workflow will use it)
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: performance-tracking
57+
path: ./*.artifact

.github/workflows/ci-julia-nightly.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
branches: [master, main]
55
tags: ["*"]
66
pull_request:
7+
env:
8+
PYTHON: ~
79
jobs:
810
test:
911
name: Julia ${{ matrix.version }} - t=${{ matrix.threads }} - jet=${{ matrix.jet }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -28,22 +30,14 @@ jobs:
2830
with:
2931
version: ${{ matrix.version }}
3032
arch: ${{ matrix.arch }}
31-
- uses: actions/cache@v4
32-
env:
33-
cache-name: cache-artifacts
34-
with:
35-
path: ~/.julia/artifacts
36-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
37-
restore-keys: |
38-
${{ runner.os }}-test-${{ env.cache-name }}-
39-
${{ runner.os }}-test-
40-
${{ runner.os }}-
33+
- uses: julia-actions/cache@v1
4134
- uses: julia-actions/julia-buildpkg@v1
4235
- uses: julia-actions/julia-runtest@v1
4336
env:
4437
JULIA_NUM_THREADS: ${{ matrix.threads }}
4538
JET_TEST: ${{ matrix.jet }}
4639
- uses: julia-actions/julia-processcoverage@v1
47-
- uses: codecov/codecov-action@v3
40+
- uses: codecov/codecov-action@v4
4841
with:
49-
file: lcov.info
42+
file: lcov.info
43+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/ci.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
branches: [master, main]
55
tags: ["*"]
66
pull_request:
7+
env:
8+
PYTHON: ~
79
jobs:
810
test:
911
name: Julia ${{ matrix.version }} - t=${{ matrix.threads }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -15,6 +17,8 @@ jobs:
1517
- '1.6'
1618
- '1.7'
1719
- '1.8'
20+
- '1.9'
21+
- '1.10'
1822
- '1'
1923
os:
2024
- ubuntu-latest
@@ -28,24 +32,16 @@ jobs:
2832
with:
2933
version: ${{ matrix.version }}
3034
arch: ${{ matrix.arch }}
31-
- uses: actions/cache@v4
32-
env:
33-
cache-name: cache-artifacts
34-
with:
35-
path: ~/.julia/artifacts
36-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
37-
restore-keys: |
38-
${{ runner.os }}-test-${{ env.cache-name }}-
39-
${{ runner.os }}-test-
40-
${{ runner.os }}-
35+
- uses: julia-actions/cache@v1
4136
- uses: julia-actions/julia-buildpkg@v1
4237
- uses: julia-actions/julia-runtest@v1
4338
env:
4439
JULIA_NUM_THREADS: ${{ matrix.threads }}
4540
- uses: julia-actions/julia-processcoverage@v1
46-
- uses: codecov/codecov-action@v3
41+
- uses: codecov/codecov-action@v4
4742
with:
4843
file: lcov.info
44+
token: ${{ secrets.CODECOV_TOKEN }}
4945
docs:
5046
name: Documentation
5147
runs-on: ubuntu-latest
@@ -54,6 +50,7 @@ jobs:
5450
- uses: julia-actions/setup-julia@v1
5551
with:
5652
version: '1'
53+
- uses: julia-actions/cache@v1
5754
- uses: julia-actions/julia-buildpkg@v1
5855
- uses: julia-actions/julia-docdeploy@v1
5956
env:

.github/workflows/downgrade.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Downgrade
2+
on:
3+
pull_request:
4+
branches: [master, main]
5+
paths-ignore:
6+
- 'docs/**'
7+
push:
8+
branches: [master, main]
9+
paths-ignore:
10+
- 'docs/**'
11+
env:
12+
PYTHON: ~
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
version: ['1.9']
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: julia-actions/setup-julia@v1
22+
with:
23+
version: ${{ matrix.version }}
24+
- uses: cjdoris/julia-downgrade-compat-action@v1
25+
with:
26+
skip: Pkg,TOML,InteractiveUtils,Random,LinearAlgebra,Dates
27+
- uses: julia-actions/cache@v1
28+
- uses: julia-actions/julia-buildpkg@v1
29+
- uses: julia-actions/julia-runtest@v1

.github/workflows/invalidations.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
version: '1'
2222
- uses: actions/checkout@v4
23+
- uses: julia-actions/cache@v1
2324
- uses: julia-actions/julia-buildpkg@v1
2425
- uses: julia-actions/julia-invalidations@v1
2526
id: invs_pr

.github/workflows/spelling.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v4
12+
- name: Check spelling
13+
uses: crate-ci/typos@master
14+
with:
15+
config: .typos.toml

.typos.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[default.extend-words]
2+
ket = "ket"
3+
4+
[type.ipynb]
5+
# It detects false possitives in the base64 encoded images inside notebooks
6+
extend-glob = ["*.ipynb"]
7+
check-file = false

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* This version no longer integrates a continuous time solver. A continuous simulation framework based on [DISCO](http://www.akira.ruc.dk/~keld/research/DISCO/) and inspired by the standalone [QSS](https://sourceforge.net/projects/qssengine/) solver using ConcurrentSim as its discrete-event engine can be found in the repository [QuantizedStateSystems](https://github.com/BenLauwens/QuantizedStateSystems.jl.git) (WIP):
4343
* Documentation is automated with [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl) (WIP: Overview and Tutorial OK).
4444
* v0.4.1 (2017)
45-
* the `@resumable` and `@yield` macros are put in a seperate package [ResumableFunctions](https://github.com/BenLauwens/ResumableFunctions.jl.git):
45+
* the `@resumable` and `@yield` macros are put in a separate package [ResumableFunctions](https://github.com/BenLauwens/ResumableFunctions.jl.git):
4646
* Users have to take into account the following syntax change: `@yield return arg` is replaced by `@yield arg`.
4747
* v0.4 (2017) only supports Julia v0.6 and above. It is a complete rewrite: more julian and less pythonic. The discrete event features are on par with v0.3 (SimPy v3) and following features are added:
4848
* Scheduling of events can be done with `Base.Dates.Datetime` and `Base.Dates.Period`

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184"
1414

1515
[compat]
1616
DataStructures = "0.18"
17+
Dates = "1"
1718
ResumableFunctions = "0.6"
1819
julia = "1.6"

0 commit comments

Comments
 (0)