-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (136 loc) · 4.26 KB
/
ci.yml
File metadata and controls
170 lines (136 loc) · 4.26 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: CI
on:
push:
branches: [ ]
permissions:
contents: write
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y meson ninja-build
- name: Build
run: make
- uses: actions/upload-artifact@v7
with:
name: build-linux
path: otezip
- name: Run tests
run: make test
- name: Run asan tests
run: make test2
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: brew install meson ninja
- name: Build
run: make
- name: Run tests
run: make -C test
- uses: actions/upload-artifact@v7
with:
name: build-macos
path: otezip
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install meson ninja
- name: Build
run: |
meson setup build --backend=ninja
ninja -C build
- uses: actions/upload-artifact@v7
with:
name: build-windows
path: build/otezip.exe
test-make:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y meson ninja-build
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: brew install meson ninja
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install meson ninja
- name: Test make build
if: matrix.os != 'windows-latest'
run: |
make clean
make
ls -la otezip
./otezip --help
- name: Test meson build (Windows)
if: matrix.os == 'windows-latest'
run: |
meson setup build --backend=ninja
ninja -C build
copy build\otezip.exe otezip.exe
dir otezip.exe
.\otezip.exe --help
check_release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
outputs:
is_release: ${{ steps.release.outputs.is }}
tag_name: ${{ steps.release.outputs.tag }}
needs:
- build-linux
- build-macos
- build-windows
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Download all git history and tags
- name: Check if is a release
run: git describe --exact-match --tags ${{ github.sha }} | awk 'BEGIN{tag="-";r="no"}/^[0-9]+\.[0-9]+/{tag=$0;r="yes"};END{print "::set-output name=is::"r;print "::set-output name=tag::"tag}'
id: release
release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.check_release.outputs.is_release == 'yes' }}
needs:
- check_release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Download all git history and tags
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist/artifacts
- name: Prepare release files
run: |
mkdir -p dist/release
cp dist/artifacts/build-linux/otezip dist/release/otezip-linux
cp dist/artifacts/build-macos/otezip dist/release/otezip-macos
cp dist/artifacts/build-windows/otezip.exe dist/release/otezip-windows.exe
- name: Create GitHub release
uses: softprops/action-gh-release@v2.5.0
with:
name: ${{ needs.check_release.outputs.tag_name }}
tag_name: ${{ needs.check_release.outputs.tag_name }}
body: |
Release ${{ needs.check_release.outputs.tag_name }}
draft: false
prerelease: false
generate_release_notes: true
files: |
dist/release/*