-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (93 loc) · 3.21 KB
/
ci.yaml
File metadata and controls
114 lines (93 loc) · 3.21 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup Zig
uses: jassielof/setup-zig@v1
- name: Formatting
run: zig fmt .
- name: Build
run: zig build --summary all
- name: Upload release artifacts
uses: actions/upload-artifact@v7
with:
name: release-artifacts
path: zig-out/release
tests:
needs: build
name: Testing
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup Zig
uses: jassielof/setup-zig@v1
# zigit installs to ~/.local/bin (Unix) or %LOCALAPPDATA%\Programs\zigit\bin (Windows);
# those dirs are not always on PATH (especially on Windows runners).
- name: Add zigit install bin to PATH
shell: bash
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
echo "$LOCALAPPDATA/Programs/zigit/bin" >> "$GITHUB_PATH"
else
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
fi
- name: Attempt to install an app
run: zig build cli --summary all -- install https://github.com/jassielof/docent
- name: Check if the app was installed correctly
run: docent --version
# Use JSON output for stable parsing across terminals/OSes; table output includes
# box-drawing characters, so anchoring at start-of-line is fragile.
- name: Check docent is listed
shell: bash
run: zig build cli --summary all -- list --json | grep -q '"alias":"docent"'
- name: Uninstall docent
run: zig build cli --summary all -- uninstall docent --yes
- name: Check docent is not listed
shell: bash
run: |
if zig build cli --summary all -- list --json | grep -q '"alias":"docent"'; then
echo "docent is still listed as installed" >&2
exit 1
fi
- name: Check ability to install from a local path (the project itself)
run: zig build cli --summary all -- install ./
- name: Check if the app was installed correctly
run: zigit --version
# Self-update: the installed zigit binary replaces itself.
# --force rebuilds even when the commit hasn't changed (the normal CI case)
# so we actually exercise the running-binary-replacement path on every OS.
- name: Self-update zigit
run: zigit update zigit --force
- name: Verify zigit works after self-update
run: zigit --version
- name: Uninstall zigit
run: zig build cli --summary all -- uninstall zigit --yes
- name: Check zigit is not listed
shell: bash
run: |
if zig build cli --summary all -- list --json | grep -q '"alias":"zigit"'; then
echo "zigit is still listed as installed" >&2
exit 1
fi