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
+ outputs :
80
+ is_fork : ${{ steps.check-fork.outputs.is_fork }}
81
+ steps :
82
+ - name : Check if fork
83
+ id : check-fork
84
+ run : |
85
+ if [ "${{ github.repository }}" != "${{ github.event.pull_request.head.repo.full_name }}" ]; then
86
+ echo "is_fork=true" >> $GITHUB_OUTPUT
87
+ else
88
+ echo "is_fork=false" >> $GITHUB_OUTPUT
89
+ fi
78
90
check :
79
- needs : [check-needs-run, generate-job-matrix]
91
+ needs : [check-needs-run, generate-job-matrix, check-is-fork ]
80
92
permissions :
81
93
pull-requests : write
82
94
contents : write
@@ -103,49 +115,49 @@ jobs:
103
115
# # run: |
104
116
# # sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
105
117
- name : Checkout
106
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' }}
118
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) }}
107
119
uses : actions/checkout@v4
108
120
- uses : actions-rs/toolchain@v1
109
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' }}
121
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) }}
110
122
with :
111
123
toolchain : stable
112
124
override : true
113
125
- name : Rust Cache
114
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' }}
126
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) }}
115
127
116
128
with :
117
129
# reasoning: we want to cache xtask, most of the jobs in the matrix will be sped up a good bit thanks to that
118
130
save-if : ${{ github.ref == 'refs/heads/main' }}
119
131
cache-all-crates : true
120
132
121
133
- name : Setup
122
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' }}
134
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) }}
123
135
run : |
124
136
cargo xtask init
125
137
126
138
- name : Setup GPU Drivers
127
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' && matrix.run_args.requires_gpu }}
139
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) && matrix.run_args.requires_gpu }}
128
140
run : |
129
141
sudo add-apt-repository ppa:kisak/turtle -y
130
142
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
131
143
- name : Check
132
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' && !matrix.run_args.requires_gpu }}
144
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) && !matrix.run_args.requires_gpu }}
133
145
run : |
134
146
${{ matrix.run_args.command }}
135
147
- name : Check With virtual X11 server
136
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' && matrix.run_args.requires_gpu }}
148
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) && matrix.run_args.requires_gpu }}
137
149
run : |
138
150
xvfb-run ${{ matrix.run_args.command }}
139
151
140
152
- name : Upload coverage artifact
141
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' && matrix.run_args.generates_coverage }}
153
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) && matrix.run_args.generates_coverage }}
142
154
uses : actions/upload-artifact@v4
143
155
with :
144
156
name : code-coverage-report
145
157
path : target/coverage/html/
146
158
147
159
- name : Update coverage badge
148
- if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.run_on_forks == 'true' && matrix.run_args.generates_coverage }}
160
+ if : ${{ needs.check-needs-run.outputs.any-changes == 'true' && ( matrix.run_args.run_on_forks == 'true' && needs.check-is-fork.is_fork) && matrix.run_args.generates_coverage }}
149
161
continue-on-error : true
150
162
run : |
151
163
git checkout -b chore/_update-coverage-badge || git checkout chore/_update-coverage-badge
0 commit comments