-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy path.cirrus.yml
More file actions
200 lines (161 loc) 路 6.59 KB
/
Copy path.cirrus.yml
File metadata and controls
200 lines (161 loc) 路 6.59 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Linux build with more disk space and CPU
linux_build_task:
name: Build Linux
compute_engine_instance:
image_project: cirrus-images
image: family/docker-kvm
platform: linux
cpu: 8
memory: 16G
disk: 100
# Cache Nix store
nix_cache:
folder: /nix
fingerprint_script: cat devenv.nix devenv.lock
install_nix_script: |
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# Configure binary caches for devenv
sudo mkdir -p /etc/nix
echo "extra-substituters = https://devenv.cachix.org" | sudo tee -a /etc/nix/nix.conf
echo "extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" | sudo tee -a /etc/nix/nix.conf
# Restart nix-daemon to pick up new config
sudo systemctl restart nix-daemon || true
install_devenv_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix profile install --accept-flake-config github:cachix/devenv/latest
setup_environment_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
devenv shell echo "Development environment ready"
build_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
df -h
devenv shell cargo build --release
df -h
test_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
devenv shell cargo test
package_script: |
mkdir -p artifacts
# Copy all executables
cp target/release/cursed artifacts/cursed
cp target/release/cursed-doc artifacts/cursed-doc
cp target/release/cursed-build artifacts/cursed-build
cp target/release/cursed-pkg artifacts/cursed-pkg
cp target/release/cursed-repl artifacts/cursed-repl
cp target/release/cursed-test artifacts/cursed-test
cp target/release/cursed-lsp artifacts/cursed-lsp
cp target/release/cursed-debug artifacts/cursed-debug
cp target/release/cursed-compile-fast artifacts/cursed-compile-fast
# Strip binaries
strip artifacts/*
# Create tarball
tar -czf cursed-linux-x86_64.tar.gz -C artifacts .
artifacts:
path: "cursed-linux-x86_64.tar.gz"
# macOS build
macos_build_task:
name: Build macOS
macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sequoia
cpu: 4
memory: 8G
# Cache Nix store
nix_cache:
folder: /nix
fingerprint_script: cat devenv.nix devenv.lock
install_nix_script: |
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# Configure binary caches for devenv
sudo mkdir -p /etc/nix
echo "extra-substituters = https://devenv.cachix.org" | sudo tee -a /etc/nix/nix.conf
echo "extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" | sudo tee -a /etc/nix/nix.conf
# Restart nix-daemon to pick up new config (macOS)
sudo launchctl kickstart -k system/org.nixos.nix-daemon || true
install_devenv_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix profile install --accept-flake-config github:cachix/devenv/latest
setup_environment_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
devenv shell echo "Development environment ready"
build_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
df -h
devenv shell cargo build --release
df -h
test_script: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
devenv shell cargo test
package_script: |
mkdir -p artifacts
# Copy all executables
cp target/release/cursed artifacts/cursed
cp target/release/cursed-doc artifacts/cursed-doc
cp target/release/cursed-build artifacts/cursed-build
cp target/release/cursed-pkg artifacts/cursed-pkg
cp target/release/cursed-repl artifacts/cursed-repl
cp target/release/cursed-test artifacts/cursed-test
cp target/release/cursed-lsp artifacts/cursed-lsp
cp target/release/cursed-debug artifacts/cursed-debug
cp target/release/cursed-compile-fast artifacts/cursed-compile-fast
# Strip binaries
strip artifacts/*
# Create tarball
tar -czf cursed-macos-x86_64.tar.gz -C artifacts .
artifacts:
path: "cursed-macos-x86_64.tar.gz"
# Release task - only runs on tags on trunk branch
release_task:
name: Create Release
depends_on:
- linux_build
- macos_build
only_if: $CIRRUS_TAG != "" && $CIRRUS_BRANCH == "trunk"
env:
GITHUB_TOKEN: ENCRYPTED[df4cea961775aeb6475f012a135b0249089fdfc0ebba4d69f9e5a61e9dce037d2af7604b4cec1c9feed3958e475900c1]
container:
image: alpine:latest
install_tools_script: |
apk add --no-cache curl jq
create_release_script: |
# Download artifacts from previous tasks
curl -o cursed-linux-x86_64.tar.gz \
"https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/linux_build/cursed-linux-x86_64.tar.gz"
curl -o cursed-macos-x86_64.tar.gz \
"https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/macos_build/cursed-macos-x86_64.tar.gz"
# Create GitHub release using GitHub CLI or API
# This requires GITHUB_TOKEN to be set as an encrypted variable
if [ -n "$GITHUB_TOKEN" ]; then
# Create release
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases" \
-d "{
\"tag_name\": \"$CIRRUS_TAG\",
\"name\": \"Release $CIRRUS_TAG\",
\"body\": \"Automated release created by Cirrus CI\",
\"draft\": false,
\"prerelease\": false
}" > release.json
# Get upload URL
UPLOAD_URL=$(jq -r '.upload_url' release.json | sed 's/{?name,label}//')
# Upload Linux artifact
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/gzip" \
--data-binary @cursed-linux-x86_64.tar.gz \
"$UPLOAD_URL?name=cursed-linux-x86_64.tar.gz"
# Upload macOS artifact
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/gzip" \
--data-binary @cursed-macos-x86_64.tar.gz \
"$UPLOAD_URL?name=cursed-macos-x86_64.tar.gz"
else
echo "GITHUB_TOKEN not set, skipping release creation"
fi