-
-
Notifications
You must be signed in to change notification settings - Fork 309
136 lines (119 loc) · 4.86 KB
/
main.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
name: CI
on:
push:
paths:
- ".github/workflows/main.yml"
- "**.zig"
- "build.zig.zon"
pull_request:
paths:
- ".github/workflows/main.yml"
- "**.zig"
- "build.zig.zon"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
bypass_tracy_and_artifacts:
type: boolean
description: Bypass Tracy and artifact builds (much faster)
jobs:
build:
if: github.repository_owner == 'zigtools'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: goto-bus-stop/setup-zig@v2
with:
version: master
- run: zig version
- run: zig env
- name: Build
run: zig build
- name: Build with Tracy
if: ${{ matrix.os != 'macos-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
run: zig build -Denable_tracy
- name: Run Tests
run: zig build test
- name: Build artifacts
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
run: |
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "x86-windows" "x86-linux" "aarch64-linux" "aarch64-macos" "wasm32-wasi")
mkdir -p "artifacts/"
for target in "${targets[@]}"; do
mkdir -p artifacts/$target
echo "Building target ${target}..."
if [ "${GITHUB_REF##*/}" == "master" ]; then
echo "Building safe"
zig build -Dtarget=${target} -Dcpu=baseline -Doptimize=ReleaseSafe --prefix artifacts/${target}/
else
echo "Building debug as action is not running on master"
zig build -Dtarget=${target} -Dcpu=baseline --prefix artifacts/${target}/
fi
sed -e '1,5d' < README.md > artifacts/${target}/README.md
cp LICENSE artifacts/${target}/
done
- name: Upload x86_64-windows artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86_64-windows
path: artifacts/x86_64-windows/
- name: Upload x86_64-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86_64-linux
path: artifacts/x86_64-linux/
- name: Upload x86_64-macos artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86_64-macos
path: artifacts/x86_64-macos/
- name: Upload x86-windows artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86-windows
path: artifacts/x86-windows/
- name: Upload x86-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86-linux
path: artifacts/x86-linux/
- name: Upload aarch64-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-aarch64-linux
path: artifacts/aarch64-linux/
- name: Upload aarch64-macos artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-aarch64-macos
path: artifacts/aarch64-macos/
- name: Upload wasm32-wasi artifact
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
uses: actions/upload-artifact@v3
with:
name: zls-wasm32-wasi
path: artifacts/wasm32-wasi/
- name: Beam to Felix
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' && github.repository_owner == 'zigtools' }}
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVKEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "artifacts/"
REMOTE_HOST: ${{ secrets.WEBSITE_DEPLOY_HOST }}
REMOTE_USER: ${{ secrets.WEBSITE_DEPLOY_USER }}
TARGET: ${{ secrets.WEBSITE_DEPLOY_FOLDER }}