-
Notifications
You must be signed in to change notification settings - Fork 3
107 lines (86 loc) · 2.71 KB
/
build.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
name: Build and Release (on GitHub only)
on:
# when a push is made to the main branch (like when a pull request is merged, or something is pushed directly)
workflow_dispatch:
push:
branches: [ "main", "pr/adisidev/201" ]
env:
BUILD_TYPE: Release
jobs:
set-outputs:
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.vars.outputs.short_sha }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Calculate short_sha
id: vars
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build-and-upload:
runs-on: ubuntu-latest
needs: set-outputs
container:
image: gocartio/cartogram-web:latest
steps:
- name: Install Dependencies
run: |
apt update -y
apt install -y git g++-11 build-essential cmake libboost-all-dev
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRELEASE_TAG=${{ needs.set-outputs.outputs.short_sha }}
- name: Build
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install -j4 --
# - name: Run CTest
# working-directory: ${{github.workspace}}/build
# # Execute tests defined by the CMake configuration.
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C ${{env.BUILD_TYPE}}
# - name: Run Stress Test
# run: |
# sudo make install -C build
# cd tests/
# chmod +x stress_test.sh
# bash stress_test.sh
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cartogram
path: /usr/local/bin/cartogram
release:
runs-on: ubuntu-latest
needs: [build-and-upload, set-outputs]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: cartogram
- name: Push tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ needs.set-outputs.outputs.short_sha }}',
sha: context.sha
})
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.set-outputs.outputs.short_sha }}
files: cartogram
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}