Skip to content

Commit ef229b2

Browse files
authored
Lower verbosity and enable testing with wsl (#27)
1 parent 389ce0d commit ef229b2

File tree

2 files changed

+73
-20
lines changed

2 files changed

+73
-20
lines changed

.github/workflows/test.yml

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,81 @@ on:
1212

1313
jobs:
1414
build:
15-
name: Build
15+
name: ${{ matrix.name || matrix.runs-on }}
1616
env:
17-
ACTIONS_RUNNER_DEBUG: "true"
18-
ACTIONS_STEP_DEBUG: "true"
19-
17+
# ACTIONS_RUNNER_DEBUG: "true"
18+
# ACTIONS_STEP_DEBUG: "true"
19+
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
20+
# https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/
21+
WSLENV: HOSTNAME:CI:FORCE_COLOR:GITHUB_ACTION:GITHUB_ACTION_PATH/p:GITHUB_ACTION_REPOSITORY:GITHUB_WORKFLOW:GITHUB_WORKSPACE/p:GITHUB_PATH/p:GITHUB_ENV/p:VIRTUAL_ENV/p:SKIP_PODMAN:SKIP_DOCKER:NODE_OPTIONS
22+
# We define a hostname because otherwise the variable might not always be accessible on runners.
23+
HOSTNAME: gha
24+
defaults:
25+
run:
26+
shell: ${{ contains(matrix.name, 'wsl') && 'wsl-bash {0}' || 'bash' }}
2027
strategy:
2128
matrix:
22-
runs-on: [ubuntu-24.04, ubuntu-24.04-arm, macos-15, windows-2025]
29+
# runs-on: [ubuntu-24.04, ubuntu-24.04-arm, macos-15, windows-2025]
30+
include:
31+
- runs-on: windows-2025
32+
name: windows-2025
33+
- runs-on: windows-2025
34+
name: windows-2025-wsl
35+
- runs-on: ubuntu-24.04
36+
name: ubuntu-24.04
37+
- runs-on: ubuntu-24.04-arm
38+
name: ubuntu-24.04-arm
39+
- runs-on: macos-15
40+
name: macos-15
2341
fail-fast: false
2442

2543
runs-on: ${{ matrix.runs-on }}
2644

2745
steps:
46+
# https://github.com/marketplace/actions/setup-wsl
47+
- name: Activate WSL
48+
if: contains(matrix.name, 'wsl') && (matrix.runs-on || '') != 'self-hosted'
49+
uses: Vampire/setup-wsl@v6.0.0
50+
with:
51+
distribution: Ubuntu-24.04
52+
set-as-default: "true"
53+
# '-i' seems to be the only option that loads .bashrc file that we need
54+
# https://github.com/Vampire/setup-wsl/discussions/54
55+
wsl-shell-command: "bash -i -eo pipefail"
56+
# https://github.com/MicrosoftDocs/WSL/blob/main/WSL/wsl-config.md#L159
57+
wsl-conf: |
58+
[automount]
59+
enabled = true
60+
root = /
61+
options = "metadata,umask=077"
62+
[boot]
63+
command=/etc/init.d/dbus start
64+
[interop]
65+
enabled = false
66+
appendWindowsPath = false
67+
[network]
68+
hostname = wsl
69+
additional-packages: curl
2870

2971
- name: Checkout
3072
uses: actions/checkout@v4
3173

3274
- name: Install the latest version of uv
75+
if: ${{ runner.os != 'Windows' }}
3376
uses: astral-sh/setup-uv@v6
3477
with:
3578
version: "latest"
79+
ignore-nothing-to-cache: true
3680
enable-cache: true
3781

3882
- uses: actions/cache@v4
83+
if: ${{ runner.os != 'Windows' }}
3984
with:
4085
path: ~/.cache/pre-commit/
4186
key: pre-commit-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
4287

4388
- name: Lint
89+
if: ${{ runner.os != 'Windows' }}
4490
# See https://github.com/rhysd/actionlint/issues/555
4591
run: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' && 'SKIP=actionlint ' || '' }}uvx --with pre-commit-uv pre-commit run --all-files
4692

@@ -53,39 +99,44 @@ jobs:
5399
mkdir -p symlink/
54100
echo "Lorem ipsum dolor sit amet" > path/to/dir-1/file1.txt
55101
echo "Hello world from file #2" > path/to/dir-2/file2.txt
102+
# shell: bash
103+
104+
- name: Create artifact files (symlinks)
105+
if: ${{ !contains(matrix.name, 'wsl') }}
106+
run: |
56107
echo "Hello from a symlinked file" > symlink/original.txt
57108
ln -s "$(pwd)/symlink/original.txt" symlink/abs.txt
58109
ln -s original.txt symlink/rel.txt
59-
shell: bash
60110
61111
# Upload a single file artifact
62112
- name: 'Upload artifact #1'
63113
uses: ./
64114
with:
65-
name: 'Artifact-A-${{ matrix.runs-on }}'
115+
name: 'Artifact-A-${{ matrix.name }}'
66116
path: path/to/dir-1/file1.txt
67117

68118
# Upload using a wildcard pattern
69119
- name: 'Upload artifact #2'
70120
uses: ./
71121
with:
72-
name: 'Artifact-Wildcard-${{ matrix.runs-on }}'
122+
name: 'Artifact-Wildcard-${{ matrix.name }}'
73123
path: path/**/dir*/
74124

75125
# Upload a multi-path artifact
76126
- name: 'Upload artifact #3'
77127
uses: ./
78128
with:
79-
name: 'Multi-Path-Artifact-${{ matrix.runs-on }}'
129+
name: 'Multi-Path-Artifact-${{ matrix.name }}'
80130
path: |
81131
path/to/dir-1/*
82132
path/to/dir-[23]/*
83133
!path/to/dir-3/*.txt
84134
85135
- name: 'Upload symlinked artifact'
136+
if: ${{ !contains(matrix.name, 'wsl') }}
86137
uses: ./
87138
with:
88-
name: 'Symlinked-Artifact-${{ matrix.runs-on }}'
139+
name: 'Symlinked-Artifact-${{ matrix.name }}'
89140
path: |
90141
symlink/abs.txt
91142
symlink/rel.txt
@@ -94,7 +145,7 @@ jobs:
94145
- name: 'Download artifact #1'
95146
uses: actions/download-artifact@v4
96147
with:
97-
name: 'Artifact-A-${{ matrix.runs-on }}'
148+
name: 'Artifact-A-${{ matrix.name }}'
98149
path: some/new/path
99150

100151
- name: 'Verify Artifact #1'
@@ -114,7 +165,7 @@ jobs:
114165
- name: 'Download artifact #2'
115166
uses: actions/download-artifact@v4
116167
with:
117-
name: 'Artifact-Wildcard-${{ matrix.runs-on }}'
168+
name: 'Artifact-Wildcard-${{ matrix.name }}'
118169
path: some/other/path
119170

120171
- name: 'Verify Artifact #2'
@@ -135,7 +186,7 @@ jobs:
135186
- name: 'Download artifact #3'
136187
uses: actions/download-artifact@v4
137188
with:
138-
name: 'Artifact-Wildcard-${{ matrix.runs-on }}'
189+
name: 'Artifact-Wildcard-${{ matrix.name }}'
139190
path: verify-artifact-3
140191

141192
- name: 'Verify Artifact #3'
@@ -156,7 +207,7 @@ jobs:
156207
- name: 'Download artifact #4'
157208
uses: actions/download-artifact@v4
158209
with:
159-
name: 'Multi-Path-Artifact-${{ matrix.runs-on }}'
210+
name: 'Multi-Path-Artifact-${{ matrix.name }}'
160211
path: multi/artifact
161212

162213
- name: 'Verify Artifact #4'
@@ -174,12 +225,14 @@ jobs:
174225
shell: pwsh
175226

176227
- name: 'Download symlinked artifact'
228+
if: ${{ !contains(matrix.name, 'wsl') }}
177229
uses: actions/download-artifact@v4
178230
with:
179-
name: 'Symlinked-Artifact-${{ matrix.runs-on }}'
231+
name: 'Symlinked-Artifact-${{ matrix.name }}'
180232
path: from/symlink
181233

182234
- name: 'Verify symlinked artifact'
235+
if: ${{ !contains(matrix.name, 'wsl') }}
183236
run: |
184237
$abs = "from/symlink/abs.txt"
185238
if(!(Test-Path -path $abs))
@@ -209,15 +262,15 @@ jobs:
209262
- name: 'Overwrite artifact #1'
210263
uses: ./
211264
with:
212-
name: 'Artifact-A-${{ matrix.runs-on }}'
265+
name: 'Artifact-A-${{ matrix.name }}'
213266
path: path/to/dir-1/file1.txt
214267
overwrite: true
215268

216269
# Download replaced Artifact #1 and verify the correctness of the content
217270
- name: 'Download artifact #1 again'
218271
uses: actions/download-artifact@v4
219272
with:
220-
name: 'Artifact-A-${{ matrix.runs-on }}'
273+
name: 'Artifact-A-${{ matrix.name }}'
221274
path: overwrite/some/new/path
222275

223276
- name: 'Verify Artifact #1 again'

scripts/ensure-gitleaks.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fi
3636
if [[ -n "$gitleaks_cmd" ]]; then
3737
version="$($gitleaks_cmd --version 2>/dev/null || true)"
3838
if [[ -n "$version" ]]; then
39-
echo "::notice::Detected ${gitleaks_cmd} version ${version} on ${platform}."
39+
echo "::debug::Detected ${gitleaks_cmd} version ${version} on ${platform}."
4040
exit 0
4141
else
4242
echo "::warning::Found gitleaks at ${gitleaks_cmd} but version check failed. Will attempt to reinstall."
@@ -64,7 +64,7 @@ if [[ -z "$gitleaks_cmd" ]]; then
6464
fi
6565
return 1
6666
}
67-
67+
6868
# Function to fetch version using curl as fallback
6969
fetch_version_with_curl() {
7070
local version_tag
@@ -131,4 +131,4 @@ fi
131131
echo "platform=$platform";
132132
echo "version=${version}";
133133
} >> "${GITHUB_OUTPUT:-/dev/stdout}"
134-
echo "::notice::Detected ${gitleaks_cmd} version ${version} on ${platform}."
134+
echo "::debug::Detected ${gitleaks_cmd} version ${version} on ${platform}."

0 commit comments

Comments
 (0)