Skip to content

Commit 5da01a2

Browse files
authored
Merge pull request #45 from upstat-io/dev
feat(ci): nightly releases, fix LLVM CI and pipefail masking
2 parents 8fdecb7 + fb07500 commit 5da01a2

2 files changed

Lines changed: 111 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
id: rust-tests
7676
continue-on-error: true
7777
run: |
78+
set -o pipefail
7879
cargo test --workspace 2>&1 | tee rust-test-output.txt
7980
# Sum all "X passed" counts from "test result:" lines
8081
RUST_TESTS=$(grep -oE '[0-9]+ passed' rust-test-output.txt | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
@@ -86,6 +87,7 @@ jobs:
8687
id: ori-tests
8788
continue-on-error: true
8889
run: |
90+
set -o pipefail
8991
cargo run -p oric --bin ori -- test tests/ 2>&1 | tee ori-test-output.txt
9092
# Extract from "1677 passed, 0 failed" format
9193
ORI_TESTS=$(grep -oE '[0-9]+ passed' ori-test-output.txt | grep -oE '^[0-9]+' | tail -1 || echo "0")
@@ -97,6 +99,7 @@ jobs:
9799
id: rt-tests
98100
continue-on-error: true
99101
run: |
102+
set -o pipefail
100103
cargo test --manifest-path compiler/ori_rt/Cargo.toml 2>&1 | tee rt-test-output.txt
101104
RT_TESTS=$(grep -oE '[0-9]+ passed' rt-test-output.txt | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
102105
RT_FAILED=$(grep -oE '[0-9]+ failed' rt-test-output.txt | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
@@ -182,42 +185,52 @@ jobs:
182185
- name: Ori language tests
183186
run: cargo run -p oric --bin ori -- test tests/
184187

185-
# LLVM backend - runs in Docker, non-blocking for now
186-
# TODO: Make this blocking once LLVM backend is stable
188+
# LLVM backend - not in ci-success `needs`, so failures show red but don't block merges
187189
llvm:
188190
name: LLVM Backend
189191
if: "!startsWith(github.event.head_commit.message, 'chore: release v')"
190192
runs-on: ubuntu-latest
191-
timeout-minutes: 60
192-
continue-on-error: true # Non-blocking during pre-alpha
193+
timeout-minutes: 30
193194
steps:
194195
- uses: actions/checkout@v4
195196

196-
- name: Set up Docker Buildx
197-
uses: docker/setup-buildx-action@v3
197+
- name: Install LLVM 17
198+
run: |
199+
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
200+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-17 main" | sudo tee /etc/apt/sources.list.d/llvm.list
201+
sudo apt-get update
202+
sudo apt-get install -y --no-install-recommends llvm-17 llvm-17-dev libpolly-17-dev clang-17 lld-17
203+
env:
204+
DEBIAN_FRONTEND: noninteractive
198205

199-
- name: Build LLVM Docker image
200-
uses: docker/build-push-action@v6
206+
- uses: dtolnay/rust-toolchain@stable
201207
with:
202-
context: docker/llvm
203-
load: true
204-
tags: ori-llvm:latest
205-
cache-from: type=gha
206-
cache-to: type=gha,mode=max
208+
components: clippy
209+
210+
- uses: Swatinem/rust-cache@v2
211+
with:
212+
key: llvm
207213

208214
- name: LLVM clippy
209-
run: ./llvm-clippy.sh
215+
run: cargo clippy --manifest-path compiler/ori_llvm/Cargo.toml --all-targets -- -D warnings
216+
env:
217+
LLVM_SYS_170_PREFIX: /usr/lib/llvm-17
210218

211219
- name: LLVM tests
212220
id: llvm-tests
213221
continue-on-error: true
214222
run: |
215-
./llvm-test.sh 2>&1 | tee llvm-test-output.txt
223+
set -o pipefail
224+
cargo build -p oric -p ori_rt --features llvm -q
225+
cargo test --manifest-path compiler/ori_rt/Cargo.toml 2>&1 | tee rt-llvm-output.txt
226+
cargo test --manifest-path compiler/ori_llvm/Cargo.toml 2>&1 | tee llvm-test-output.txt
216227
# Sum all "X passed" counts from test output
217-
LLVM_TESTS=$(grep -oE '[0-9]+ passed' llvm-test-output.txt | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
218-
LLVM_FAILED=$(grep -oE '[0-9]+ failed' llvm-test-output.txt | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
228+
LLVM_TESTS=$(cat rt-llvm-output.txt llvm-test-output.txt | grep -oE '[0-9]+ passed' | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
229+
LLVM_FAILED=$(cat rt-llvm-output.txt llvm-test-output.txt | grep -oE '[0-9]+ failed' | grep -oE '^[0-9]+' | awk '{sum+=$1} END {print sum+0}')
219230
echo "LLVM_TESTS=$LLVM_TESTS" >> $GITHUB_ENV
220231
echo "LLVM_FAILED=$LLVM_FAILED" >> $GITHUB_ENV
232+
env:
233+
LLVM_SYS_170_PREFIX: /usr/lib/llvm-17
221234

222235
- name: Save LLVM test results
223236
if: always()
@@ -246,6 +259,10 @@ jobs:
246259
path: llvm-test-results.json
247260
retention-days: 90
248261

262+
- name: Fail if LLVM tests failed
263+
if: steps.llvm-tests.outcome == 'failure'
264+
run: exit 1
265+
249266
# Single status check for branch protection
250267
ci-success:
251268
name: CI Success

.github/workflows/nightly.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Nightly Release
2+
3+
# Create a PR from dev → master every night if there are new commits.
4+
# The existing auto-release workflow tags and releases after merge.
5+
6+
on:
7+
schedule:
8+
# Every day at midnight UTC
9+
- cron: '0 0 * * *'
10+
workflow_dispatch: # Manual trigger for testing
11+
12+
jobs:
13+
nightly-pr:
14+
name: Nightly PR
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 5
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
token: ${{ secrets.ORILANG_RELEASE_TOKEN }}
23+
fetch-depth: 0
24+
25+
- name: Check for new commits
26+
id: check
27+
run: |
28+
git fetch origin master dev
29+
AHEAD=$(git rev-list --count origin/master..origin/dev)
30+
echo "ahead=$AHEAD" >> $GITHUB_OUTPUT
31+
if [ "$AHEAD" -eq 0 ]; then
32+
echo "No new commits on dev since last merge. Skipping."
33+
else
34+
echo "$AHEAD new commit(s) on dev ahead of master."
35+
fi
36+
37+
- name: Check for existing PR
38+
if: steps.check.outputs.ahead != '0'
39+
id: existing
40+
env:
41+
GH_TOKEN: ${{ secrets.ORILANG_RELEASE_TOKEN }}
42+
run: |
43+
PR=$(gh pr list --base master --head dev --state open --json number --jq '.[0].number // empty')
44+
if [ -n "$PR" ]; then
45+
echo "PR #$PR already open. Skipping."
46+
echo "exists=true" >> $GITHUB_OUTPUT
47+
else
48+
echo "exists=false" >> $GITHUB_OUTPUT
49+
fi
50+
51+
- name: Create nightly PR
52+
if: steps.check.outputs.ahead != '0' && steps.existing.outputs.exists == 'false'
53+
env:
54+
GH_TOKEN: ${{ secrets.ORILANG_RELEASE_TOKEN }}
55+
run: |
56+
DATE=$(date -u +"%Y-%m-%d")
57+
AHEAD=${{ steps.check.outputs.ahead }}
58+
59+
gh pr create \
60+
--base master \
61+
--head dev \
62+
--title "nightly: $DATE" \
63+
--body "$(cat <<EOF
64+
## Nightly Release — $DATE
65+
66+
Automated PR with $AHEAD new commit(s) from dev.
67+
68+
This PR will auto-merge once CI passes, triggering a nightly release.
69+
EOF
70+
)"
71+
72+
- name: Enable auto-merge
73+
if: steps.check.outputs.ahead != '0' && steps.existing.outputs.exists == 'false'
74+
env:
75+
GH_TOKEN: ${{ secrets.ORILANG_RELEASE_TOKEN }}
76+
run: |
77+
gh pr merge --auto --merge --delete-branch=false

0 commit comments

Comments
 (0)