-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (108 loc) · 3.14 KB
/
cicd.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
name: 'CI/CD'
on:
workflow_dispatch:
pull_request:
push:
branches:
- 'master'
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
# Build and test
Build-and-Test:
runs-on: ubuntu-latest
container: ghcr.io/galacticusorg/buildenv:latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Generate configure
run: |
cd $GITHUB_WORKSPACE
apt update
apt install -y bison flex
git config --global --add safe.directory $GITHUB_WORKSPACE
set -o pipefail
mkdir -p config
mkdir -p m4
touch config/config.rpath
autoreconf --install --force -I/usr/local/share/aclocal
CFLAGS="-I/usr/include/x86_64-linux-gnu" ./configure
make dist
cd doc
make libmatheval.html
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: release-archive
path: 'libmatheval-1.1.12.tar.gz'
- name: Upload docs artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: 'doc/libmatheval.html'
- name: Build and test
run: |
make -j2 2>&1 | tee build.log
grep -v -q Error: build.log
grep -v -q Warning: build.log
make -j2 check 2>&1 | tee build.log
grep -v -q Error: build.log
grep -v -q Warning: build.log
set +o pipefail
Update-Release-Tag:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: Build-and-Test
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: release-archive
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload latest libmatheval-1.1.12.tar.gz --clobber
- name: Update tag
run: |
git tag -f latest
git push origin -f latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Update-Online-Docs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: Build-and-Test
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Remove old docs
run: |
mkdir -p doc
rm -rf doc
mkdir -p doc
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: docs
path: doc
- name: Update online docs
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --local user.email "[email protected]"
git config --local user.name "github-action-validate"
git add doc
git diff --cached --quiet
if [ $? -eq 1 ]; then
git commit -m "Update documentation"
git push --set-upstream origin gh-pages
fi
if: github.event_name != 'pull_request'