Skip to content

Commit 68078f6

Browse files
authored
ci: add nightly build workflow (#44)
1 parent efc1c76 commit 68078f6

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Nightly
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "17 3 * * *"
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: nightly-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
macos:
17+
name: macOS nightly
18+
runs-on: macos-latest
19+
20+
steps:
21+
- name: Check out main
22+
uses: actions/checkout@v5
23+
with:
24+
ref: main
25+
26+
- name: Install Rust toolchain
27+
uses: dtolnay/rust-toolchain@stable
28+
29+
- name: Build release binary
30+
run: cargo build --release
31+
32+
- name: Package nightly artifact
33+
env:
34+
RUN_NUMBER: ${{ github.run_number }}
35+
SHORT_SHA: ${{ github.sha }}
36+
run: |
37+
set -euo pipefail
38+
39+
case "$(uname -m)" in
40+
arm64) target_triple="aarch64-apple-darwin" ;;
41+
x86_64) target_triple="x86_64-apple-darwin" ;;
42+
*)
43+
echo "Unsupported macOS architecture: $(uname -m)" >&2
44+
exit 1
45+
;;
46+
esac
47+
48+
short_sha="$(git rev-parse --short=12 HEAD)"
49+
archive="cortex-nightly-${RUN_NUMBER}-${short_sha}-${target_triple}.tar.gz"
50+
mkdir -p dist
51+
cp target/release/cortex dist/cortex
52+
tar -czf "${archive}" -C dist cortex
53+
shasum -a 256 "${archive}" > "${archive}.sha256"
54+
55+
{
56+
echo "archive=${archive}"
57+
echo "checksum=${archive}.sha256"
58+
echo "artifact_name=cortex-nightly-${RUN_NUMBER}-${target_triple}"
59+
echo "short_sha=${short_sha}"
60+
} >> "${GITHUB_ENV}"
61+
62+
- name: Upload nightly artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: ${{ env.artifact_name }}
66+
path: |
67+
${{ env.archive }}
68+
${{ env.checksum }}
69+
if-no-files-found: error
70+
retention-days: 14
71+
72+
- name: Write nightly summary
73+
run: |
74+
{
75+
echo "## Cortex nightly"
76+
echo
77+
echo "Nightly builds are unstable test artifacts from main."
78+
echo
79+
echo "- Commit: ${short_sha}"
80+
echo "- Archive: ${archive}"
81+
echo "- Checksum: ${checksum}"
82+
} >> "${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)