-
Notifications
You must be signed in to change notification settings - Fork 68
142 lines (124 loc) · 4.81 KB
/
rust-upstream.yaml
File metadata and controls
142 lines (124 loc) · 4.81 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
name: Rust Check - Upstream (zarrs)
on:
push:
branches:
- main
- "support/**"
pull_request:
types: [opened, reopened, synchronize, labeled]
schedule:
- cron: "0 1 * * *" # Daily at 01:00 UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
issues: write
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings"
RUST_CHANNEL: '1.91.1'
CARGO_DENY_VERSION: '0.19.0'
jobs:
zarrs:
name: zarrs-upstream
runs-on: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/extras=s3-cache
continue-on-error: true
if: ${{
(contains(github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request')
|| github.event_name == 'workflow_dispatch'
|| github.event_name == 'schedule'
|| github.event_name == 'push'
}}
steps:
- uses: runs-on/action@742bf56072eb4845a0f94b3394673e4903c90ff0 # v2
- name: Checkout icechunk
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
path: "icechunk"
- name: Checkout zarrs_icechunk
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: "zarrs/zarrs_icechunk"
path: "zarrs_icechunk"
- name: Patch zarrs_icechunk to use local icechunk
shell: bash
run: |
# zarrs_icechunk already has a [patch.crates-io] section (with commented entries),
# so we append the icechunk entry under it instead of creating a duplicate section.
sed -i '/^\[patch\.crates-io\]/a icechunk = { path = "../icechunk/icechunk" }' zarrs_icechunk/Cargo.toml
- name: Install Rust toolchain
run: |
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
rustup default ${{ env.RUST_CHANNEL }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@42dc69e1aa15d09112580998cf2ef0119e2e91ae # v2
with:
workspaces: "zarrs_icechunk -> target"
key: zarrs-upstream-${{ env.RUST_CHANNEL }}
- name: Build zarrs_icechunk
id: build
shell: bash
working-directory: zarrs_icechunk
run: |
cargo build 2>&1 | tee build-output.log
- name: Test zarrs_icechunk
id: test
if: steps.build.outcome == 'success'
shell: bash
working-directory: zarrs_icechunk
run: |
cargo test 2>&1 | tee test-output.log
- name: Create or update failure issue
if: |
always()
&& (steps.build.outcome == 'failure' || steps.test.outcome == 'failure')
&& github.event_name == 'schedule'
&& github.repository_owner == 'earth-mover'
shell: bash
working-directory: .
run: |
# Read the template
template=$(cat icechunk/.github/zarrs-upstream-failure-template.md)
# Combine build and test output
test_output="=== Build Output ===
"
if [ -f "zarrs_icechunk/build-output.log" ]; then
test_output+=$(tail -100 zarrs_icechunk/build-output.log)
else
test_output+="No build output captured"
fi
test_output+="
=== Test Output ===
"
if [ -f "zarrs_icechunk/test-output.log" ]; then
test_output+=$(tail -100 zarrs_icechunk/test-output.log)
else
test_output+="No test output captured"
fi
# Replace placeholders
issue_body="${template//\{\{WORKFLOW\}\}/${{ github.workflow }}}"
issue_body="${issue_body//\{\{RUN_ID\}\}/${{ github.run_id }}}"
issue_body="${issue_body//\{\{RUN_URL\}\}/${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}}"
issue_body="${issue_body//\{\{DATE\}\}/$(date -u)}"
issue_body="${issue_body//\{\{TEST_OUTPUT\}\}/$test_output}"
# Check for existing open issue with same title
issue_title="Nightly zarrs upstream test failed"
existing_issue=$(gh issue list --state open --label "CI" --search "\"$issue_title\" in:title" --json number --jq '.[0].number // empty')
if [ -n "$existing_issue" ]; then
echo "Found existing open issue #$existing_issue, updating it..."
echo "$issue_body" | gh issue edit "$existing_issue" --body-file -
echo "Updated existing issue #$existing_issue"
else
echo "No existing open issue found, creating new one..."
echo "$issue_body" | gh issue create \
--title "$issue_title" \
--body-file - \
--label "CI"
echo "Created new issue"
fi
env:
GH_TOKEN: ${{ github.token }}