Skip to content

Commit 25a224b

Browse files
authored
Merge pull request #3423 from github/mbg/ci/yq-windows
Add `installYq` option to `sync.py` and install `yq` directly from GitHub release
2 parents 55252c7 + 3657da1 commit 25a224b

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

.github/workflows/__build-mode-autobuild.yml

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/build-mode-autobuild.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: "An end-to-end integration test of a Java repository built using 'b
33
operatingSystems: ["ubuntu", "windows"]
44
versions: ["linked", "nightly-latest"]
55
installJava: "true"
6+
installYq: "true"
67
steps:
78
- name: Set up Java test repo configuration
89
run: |
@@ -18,11 +19,6 @@ steps:
1819
languages: java
1920
tools: ${{ steps.prepare-test.outputs.tools-url }}
2021

21-
- name: Install yq
22-
if: runner.os == 'Windows'
23-
run: |
24-
choco install yq -y
25-
2622
- name: Validate database build mode
2723
run: |
2824
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"

pr-checks/sync.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
import ruamel.yaml
4-
from ruamel.yaml.scalarstring import SingleQuotedScalarString
4+
from ruamel.yaml.scalarstring import SingleQuotedScalarString, LiteralScalarString
55
import pathlib
66
import os
77

@@ -223,6 +223,25 @@ def writeHeader(checkStream):
223223
}
224224
})
225225

226+
installYq = is_truthy(checkSpecification.get('installYq', ''))
227+
228+
if installYq:
229+
steps.append({
230+
'name': 'Install yq',
231+
'if': "runner.os == 'Windows'",
232+
'env': {
233+
'YQ_PATH': '${{ runner.temp }}/yq',
234+
# This is essentially an arbitrary version of `yq`, which happened to be the one that
235+
# `choco` fetched when we moved away from using that here.
236+
# See https://github.com/github/codeql-action/pull/3423
237+
'YQ_VERSION': 'v4.50.1'
238+
},
239+
'run': LiteralScalarString(
240+
'gh release download --repo mikefarah/yq --pattern "yq_windows_amd64.exe" "$YQ_VERSION" -O "$YQ_PATH/yq.exe"\n'
241+
'echo "$YQ_PATH" >> "$GITHUB_PATH"'
242+
),
243+
})
244+
226245
# If container initialisation steps are present in the check specification,
227246
# make sure to execute them first.
228247
if 'container' in checkSpecification and 'container-init-steps' in checkSpecification:

0 commit comments

Comments
 (0)