-
Notifications
You must be signed in to change notification settings - Fork 24
91 lines (81 loc) · 2.98 KB
/
CI.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
# This is a basic workflow to help you get started with Actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * *' #Makes sense, we are testing against master
workflow_dispatch:
jobs:
build:
strategy:
matrix:
#Deactivated windows for I don't know why it fails
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Zig
# You may pin to the exact commit or the version.
# uses: goto-bus-stop/setup-zig@41ae19e72e21b9a1380e86ff9f058db709fc8fc6
uses: goto-bus-stop/setup-zig@v2.2.0
with:
version: master
cache: true # Let's see how this behaves
- run: zig version
- run: zig env
- name: Build
run: zig build --verbose
- name: Run Tests
run: zig build test
- name: Run App Tests
run: |
cd demo
zig build jetzig:test
- name: Build artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "aarch64-macos")
mkdir -p "artifacts/"
root=$(pwd)
cd cli
for target in "${targets[@]}"; do
mkdir -p $root/artifacts/$target
echo "Building target ${target}..."
if ! zig build -Dtarget=${target} -Doptimize=ReleaseSafe --prefix $root/artifacts/${target}/; then
exit 1
fi
sed -e '1,5d' < $root/README.md > $root/artifacts/${target}/README.md
cp $root/LICENSE $root/artifacts/${target}/
done
wait
- name: Upload artifacts Target Windows
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
with:
name: build-windows
path: artifacts/x86_64-windows
- name: Upload artifacts Target Linux
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
with:
name: build-linux
path: artifacts/x86_64-linux
- name: Upload artifacts Target MacOS
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
with:
name: build-macos-x86
path: artifacts/x86_64-macos
- name: Upload artifacts Target MacOS 2
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
with:
name: build-macos-aarch64
path: artifacts/aarch64-macos