-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (108 loc) · 4.69 KB
/
cmake.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
name: CMake
permissions:
contents: write
pull-requests: write
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ created ]
env:
BUILD_TYPE: Release
jobs:
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
- name: Test
run: ctest --test-dir ${{github.workspace}}/build -C ${{env.BUILD_TYPE}} --output-on-failure
- uses: actions/upload-artifact@v4
with:
name: Linux build
path: ${{github.workspace}}/build/dote
- name: Rename for upload
run: mv ${{github.workspace}}/build/dote ${{github.workspace}}/build/dote_linux
- name: Upload release binary
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2
if: github.event_name == 'release' && github.event.action == 'created'
with:
files: ${{github.workspace}}/build/dote_linux
build_linux_cross:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- architecture: mips
qemu: mips
- architecture: arm64
qemu: aarch64
steps:
- uses: actions/checkout@v4
- name: Install cross-compile dependencies
run: sudo apt-get install debootstrap qemu-user-static binfmt-support sbuild schroot
- name: Make chroot
run: |
mkdir ${{runner.temp}}/chroot
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential --arch=${{matrix.architecture}} buster ${{runner.temp}}/chroot https://archive.debian.org/debian/
sudo cp /usr/bin/qemu-${{matrix.qemu}}-static ${{runner.temp}}/chroot/usr/bin/
sudo chroot ${{runner.temp}}/chroot ./debootstrap/debootstrap --second-stage
sudo sbuild-createchroot --arch=${{matrix.architecture}} --foreign --setup-only buster ${{runner.temp}}/chroot https://archive.debian.org/debian/
- name: Install chroot dependencies
run: |
sudo chroot ${{runner.temp}}/chroot apt-get update
sudo chroot ${{runner.temp}}/chroot apt-get --allow-unauthenticated install -qq -y build-essential libssl-dev cmake g++
- name: Copy source to chroot
run: |
sudo mkdir ${{runner.temp}}/chroot/workdir
sudo cp -r ${{github.workspace}}/* ${{runner.temp}}/chroot/workdir
sudo mkdir ${{runner.temp}}/chroot/workdir/build
- name: Configure CMake
run: sudo chroot ${{runner.temp}}/chroot /bin/sh -c "cd /workdir/build && cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} /workdir"
- name: Build
run: sudo chroot ${{runner.temp}}/chroot cmake --build /workdir/build --config ${{env.BUILD_TYPE}} -- -j 4
- name: Test
run: sudo chroot ${{runner.temp}}/chroot ctest --test-dir /workdir/build -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Copy build out of chroot
run: |
sudo cp -r ${{runner.temp}}/chroot/workdir/build ${{github.workspace}}
sudo chown -R $(whoami) ${{github.workspace}}/build
- uses: actions/upload-artifact@v4
with:
name: Linux ${{matrix.architecture}} build
path: ${{github.workspace}}/build/dote
- name: Rename for upload
run: mv ${{github.workspace}}/build/dote ${{github.workspace}}/build/dote_${{matrix.architecture}}
- name: Upload release binary
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2
if: github.event_name == 'release' && github.event.action == 'created'
with:
files: ${{github.workspace}}/build/dote_${{matrix.architecture}}
build_mac:
runs-on: macos-latest
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl/
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build_mac -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build_mac --config ${{env.BUILD_TYPE}} -j 4
- name: Test
run: ctest --test-dir ${{github.workspace}}/build_mac -C ${{env.BUILD_TYPE}} --output-on-failure
- uses: actions/upload-artifact@v4
with:
name: macOS build
path: ${{github.workspace}}/build_mac/dote
- name: Rename for upload
run: mv ${{github.workspace}}/build_mac/dote ${{github.workspace}}/build_mac/dote_mac
- name: Upload release binary
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2
if: github.event_name == 'release' && github.event.action == 'created'
with:
files: ${{github.workspace}}/build_mac/dote_mac