75
75
jq -c . matrix.json > matrix-one-line.json
76
76
echo "matrix=$(cat matrix-one-line.json)" >> $GITHUB_OUTPUT
77
77
78
+ check-is-fork :
79
+ runs-on : ubuntu-latest
80
+ outputs :
81
+ is_fork : ${{ steps.check-fork.outputs.is_fork }}
82
+ steps :
83
+ - name : Check if fork
84
+ id : check-fork
85
+ run : |
86
+ if [ "${{ github.repository }}" != "${{ github.event.pull_request.head.repo.full_name }}" ]; then
87
+ echo "is_fork=true" >> $GITHUB_OUTPUT
88
+ else
89
+ echo "is_fork=false" >> $GITHUB_OUTPUT
90
+ fi
78
91
check :
79
- needs : [check-needs-run, generate-job-matrix]
92
+ needs : [check-needs-run, generate-job-matrix, check-is-fork ]
80
93
permissions :
81
94
pull-requests : write
82
95
contents : write
@@ -103,49 +116,49 @@ jobs:
103
116
# # run: |
104
117
# # sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
105
118
- name : Checkout
106
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
119
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') }}
107
120
uses : actions/checkout@v4
108
121
- uses : actions-rs/toolchain@v1
109
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
122
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') }}
110
123
with :
111
124
toolchain : stable
112
125
override : true
113
126
- name : Rust Cache
114
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
127
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') }}
115
128
uses : Swatinem/rust-cache@v2.7.7
116
129
with :
117
130
# reasoning: we want to cache xtask, most of the jobs in the matrix will be sped up a good bit thanks to that
118
131
save-if : ${{ github.ref == 'refs/heads/main' }}
119
132
cache-all-crates : true
120
133
121
134
- name : Setup
122
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
135
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') }}
123
136
run : |
124
137
cargo xtask init
125
138
126
139
- name : Setup GPU Drivers
127
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.requires_gpu }}
140
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') && matrix.run_args.requires_gpu }}
128
141
run : |
129
142
sudo add-apt-repository ppa:kisak/turtle -y
130
143
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
131
144
- name : Check
132
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && !matrix.run_args.requires_gpu }}
145
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') && !matrix.run_args.requires_gpu }}
133
146
run : |
134
147
${{ matrix.run_args.command }}
135
148
- name : Check With virtual X11 server
136
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.requires_gpu }}
149
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') && matrix.run_args.requires_gpu }}
137
150
run : |
138
151
xvfb-run ${{ matrix.run_args.command }}
139
152
140
153
- name : Upload coverage artifact
141
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.generates_coverage }}
154
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') && matrix.run_args.generates_coverage }}
142
155
uses : actions/upload-artifact@v4
143
156
with :
144
157
name : code-coverage-report
145
158
path : target/coverage/html/
146
159
147
160
- name : Update coverage badge
148
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.generates_coverage }}
161
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks == 'true' || needs.check-is-fork.is_fork != 'true') && matrix.run_args.generates_coverage }}
149
162
continue-on-error : true
150
163
run : |
151
164
git checkout -b chore/_update-coverage-badge || git checkout chore/_update-coverage-badge
@@ -163,45 +176,4 @@ jobs:
163
176
sed -n 's/.*pull\/\([0-9]*\).*/\1/p' pr.txt > pr_number.txt
164
177
PRNUMBER=$(cat pr_number.txt)
165
178
gh pr merge $PRNUMBER --squash
166
- fi
167
- generate_bindings :
168
- name : Bindings - Synchronise
169
- permissions :
170
- contents : write
171
- pull-requests : write
172
- runs-on : ubuntu-latest
173
- if : github.repository_owner == 'makspll'
174
- steps :
175
- - name : Checkout
176
- uses : actions/checkout@v4
177
- with :
178
- ref : ${{ github.head_ref || github.ref_name }}
179
- - name : Rust Cache
180
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
181
- uses : Swatinem/rust-cache@v2.7.7
182
- with :
183
- # reasoning: we want to cache xtask, most of the jobs in the matrix will be sped up a good bit thanks to that
184
- save-if : ${{ github.ref == 'refs/heads/main' }}
185
- cache-all-crates : true
186
- - name : Setup Bot GitHub Credentials
187
- run : |
188
- git config user.name "github-actions[bot]"
189
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
190
- - name : Setup
191
- run : |
192
- cargo xtask init
193
- - name : Generate Bindings
194
- run : |
195
- cargo xtask codegen
196
- - name : Check for changes
197
- id : check_changes
198
- run : |
199
- if [[ -n $(git status --porcelain) ]]; then
200
- echo "changes=true" >> "$GITHUB_OUTPUT";
201
- fi
202
- - name : Commit Changes
203
- if : steps.check_changes.outputs.changes
204
- run : |
205
- git add -A
206
- git commit -m "chore(codegen): update bevy bindings"
207
- git push
179
+ fi
0 commit comments