-
Notifications
You must be signed in to change notification settings - Fork 4
155 lines (128 loc) · 3.44 KB
/
build_and_bench.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build&bench
on:
push:
branches:
- main
paths-ignore:
- '**/.gitignore'
- '**/AUTHORS.md'
- '**/README.md'
- '**/TODO.md'
- '**/*.txt'
- '**/*.sh'
- '**/tinyxxd*.png'
- '**/tinyxxd*.svg'
pull_request:
branches-ignore:
- 'src-*-update*'
paths-ignore:
- '**/.gitignore'
- '**/AUTHORS.md'
- '**/README.md'
- '**/TODO.md'
- '**/*.txt'
- '**/*.sh'
- '**/tinyxxd*.png'
- '**/tinyxxd*.svg'
jobs:
build-linux:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update system and Install dependencies
run: |
pacman -Syu --noconfirm && \
pacman -S --noconfirm --needed curl diffutils gcc make && \
pacman -Scc --noconfirm
- name: Build
run: make
- name: Test
run: make test
build-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: make
- name: Test
run: make test
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
run: |
choco install curl diffutils make mingw -y
- name: Build
run: make CC=gcc
benchmark-linux:
needs: build-linux
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache benchmark results
uses: actions/cache@v4
with:
path: ./results.pkl
key: results-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
results-${{ github.ref }}-
- name: Install dependencies
run: |
pacman -Syu --noconfirm && \
pacman -S --noconfirm --needed curl diffutils gcc git gnuplot make python && \
pacman -Scc --noconfirm
- name: Check for cached results
run: |
if [ -f results.pkl ]; then
echo "Cached results.pkl found."
else
echo "No cached results.pkl found."
fi
- name: Run bench.py
run: python3 bench.py -s
- name: Archive results for Git operations
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
bench*.md
img/
benchmark-commit:
needs: benchmark-linux
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download benchmark results
uses: actions/download-artifact@v4
with:
name: benchmark-results
- name: Configure Git
run: |
git config user.name 'GitHub Actions'
git config user.email 'actions@github.com'
- name: Check for changes
id: git-check
run: |
git add bench*.md img/
if git diff --staged --quiet; then
echo "No changes to the content."
echo "changes=false" >> $GITHUB_ENV
else
echo "Content changes detected."
echo "changes=true" >> $GITHUB_ENV
fi
- name: Commit benchmark updates
if: env.changes == 'true'
run: |
git commit -m "Update benchmarks and images" -a
git push