Repository navigation
139 lines (130 loc) · 4.93 KB
/
Copy pathweekly.yml
File metadata and controls
139 lines (130 loc) · 4.93 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
name: Weekly beta compile test
# Based on https://github.com/bevyengine/bevy/blob/main/.github/workflows/weekly.yml
on:
schedule:
# New versions of rust release on Thursdays. We test on Mondays to get at least 3 days of warning before all our CI breaks again.
# https://forge.rust-lang.org/release/process.html#release-day-thursday
- cron: "0 12 * * 1"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_DEV_DEBUG: 0
ISSUE_TITLE: Main branch fails to compile on Rust beta.
# The jobs listed here are intentionally skipped when running on forks, for a number of reasons:
#
# * Scheduled workflows run on the base/default branch, with no way (currently) to change this. On
# forks, the base/default branch is usually kept in sync with the upstream repository, meaning
# that running this workflow on forks would just be a waste of resources.
#
# * Even if there was a way to change the branch that a scheduled workflow runs on, forks default
# to not having an issue tracker.
#
# * Even in the event that a fork's issue tracker is enabled, most users probably don't want to
# receive automated issues in the event of a compilation failure.
#
# Because of these reasons, this workflow is irrelevant for 99% of forks. Thus, the jobs here will
# be skipped when running on any repository that isn't the upstream repository.
jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
# Disable this job when running on a fork.
if: github.repository == 'wgsl-tooling-wg/wesl-rs/issues'
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@beta
- name: Build & run tests
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- test
env:
RUSTFLAGS: "-C debuginfo=0 -D warnings"
lint:
runs-on: ubuntu-latest
# Disable this job when running on a fork.
if: github.repository == 'wgsl-tooling-wg/wesl-rs/issues'
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@beta
with:
components: rustfmt, clippy
- name: Run lints
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- lints
check-compiles:
runs-on: ubuntu-latest
# Disable this job when running on a fork.
if: github.repository == 'wgsl-tooling-wg/wesl-rs/issues'
timeout-minutes: 30
needs: ["test"]
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@beta
- name: Check compile test
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- compile
close-any-open-issues:
runs-on: ubuntu-latest
needs: ["test", "lint", "check-compiles"]
permissions:
issues: write
steps:
- name: Close issues
run: |
previous_issue_number=$(gh issue list \
--search "$ISSUE_TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close $previous_issue_number \
-r completed \
-c $COMMENT
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
COMMENT: |
[Last pipeline run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) successfully completed. Closing issue.
open-issue:
name: Warn that weekly CI fails
runs-on: ubuntu-latest
needs: [test, lint, check-compiles]
permissions:
issues: write
# We disable this job on forks, because
# Use always() so the job doesn't get canceled if any other jobs fail
if: ${{ github.repository == 'wgsl-tooling-wg/wesl-rs/issues' && always() && contains(needs.*.result, 'failure') }}
steps:
- name: Create issue
run: |
previous_issue_number=$(gh issue list \
--search "$ISSUE_TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue comment $previous_issue_number \
--body "Weekly pipeline still fails: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
else
gh issue create \
--title "$ISSUE_TITLE" \
--label "$LABELS" \
--body "$BODY"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
LABELS:
BODY: |
## Weekly CI run has failed.
[The offending run.](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})