Skip to content

Commit cca1031

Browse files
committed
CI: Implement custom actions
Currently implements just benchmarks
1 parent 32a8eaa commit cca1031

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/CustomCommands.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Custom Commands
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
custom_actions:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Wait for commands
11+
id: read_commands
12+
run: |
13+
while true; do
14+
ci_commands=$(curl -sH "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X GET "${{ github.event.pull_request.comments_url }}" | jq -r ".[] | select(.body | startswith(\"/run-actions\")) | .body")
15+
if [ ! -z "$ci_commands" ]; then
16+
echo "Read commands $ci_commands"
17+
echo "ci_commands=$ci_commands" >> $GITHUB_OUTPUT
18+
break
19+
fi
20+
sleep 30
21+
done
22+
23+
- uses: actions/checkout@v2
24+
- uses: julia-actions/setup-julia@v1
25+
with:
26+
version: '1.9'
27+
arch: 'x64'
28+
29+
- name: Run provided commands
30+
run: |
31+
echo "Got custom commands:"
32+
ci_commands="${{ steps.read_commands.outputs.ci_commands }}"
33+
echo $ci_commands
34+
if echo "$ci_commands" | grep -q benchmark; then
35+
echo "Running benchmarks..."
36+
julia -e 'using Pkg; Pkg.add("BenchmarkTools"); Pkg.develop(;path=pwd())'
37+
JULIA_PROJECT=$PWD julia --project benchmarks/benchmark.jl
38+
fi
39+
if echo "$ci_commands" | grep -q format; then
40+
echo "Running formatter..."
41+
fi
42+
if echo "$ci_commands" | grep -q premerge; then
43+
echo "Running pre-merge checks..."
44+
fi
45+
env:
46+
BENCHMARK: "nmf:raw,dagger"
47+
BENCHMARK_SCALE: "5:5:10"

0 commit comments

Comments
 (0)