Skip to content

Commit d9f776c

Browse files
committed
ci: refactor tests, disable Windows tests by default
1 parent 7145482 commit d9f776c

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ on:
2929
- "!**/*.md"
3030

3131
workflow_dispatch:
32+
inputs:
33+
run-on-windows:
34+
description: Run tests on Windows
35+
type: boolean
36+
default: false
37+
required: false
3238

3339
concurrency:
3440
group: tests-${{ github.ref }}
@@ -39,6 +45,8 @@ jobs:
3945
permissions: {}
4046
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
4147
uses: ./.github/workflows/tests.yml
48+
with:
49+
run-on-windows: ${{ inputs.run-on-windows || contains(github.event.head_commit.message, '[test windows]') }}
4250

4351
pkg-pr-new:
4452
name: ⚡ pkg.pr.new

.github/workflows/tests.yml

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1-
on: [workflow_call]
1+
on:
2+
workflow_call:
3+
inputs:
4+
run-on-windows:
5+
required: false
6+
type: boolean
7+
default: false
28

39
permissions: {}
410

5-
env:
6-
WINDOWS_USERPROFILE: "D:"
7-
WINDOWS_BUN_CACHE_DIR: 'D:\.bun\install\cache'
8-
911
jobs:
1012
test:
1113
name: 🧪 Tests
1214
strategy:
1315
fail-fast: false
1416
matrix:
15-
os: [ubuntu-latest, windows-latest]
17+
os:
18+
- ubuntu-latest
19+
- ${{ inputs.run-on-windows && 'windows-latest' || '' }}
20+
exclude:
21+
- os: ""
1622

1723
runs-on: ${{ matrix.os }}
1824

1925
steps:
20-
# https://ichard26.github.io/blog/2025/03/faster-pip-ci-on-windows-d-drive/#moving-temp-to-the-d-drive
21-
- name: 🗂️ Configure Temp Directory (Windows)
22-
if: runner.os == 'Windows'
23-
shell: pwsh
24-
run: |
25-
$TEMP_DIR = "$env:WINDOWS_USERPROFILE\Temp"
26-
# Create temp dir
27-
New-Item -ItemType Directory -Force -Path $TEMP_DIR | Out-Null
28-
29-
"TEMP=$TEMP_DIR" >> $env:GITHUB_ENV
30-
"TMP=$TEMP_DIR" >> $env:GITHUB_ENV
31-
32-
- name: 🔓 Disable Windows Defender (Windows)
33-
if: runner.os == 'Windows'
34-
shell: powershell
35-
run: Set-MpPreference -DisableRealtimeMonitoring $true
36-
3726
- name: 📥 Checkout
3827
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3928
with:
@@ -52,25 +41,19 @@ jobs:
5241
5342
- name: 🔧 Setup Bun
5443
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
55-
env:
56-
USERPROFILE: ${{ env.WINDOWS_USERPROFILE }}
5744
with:
5845
bun-version: latest
5946

60-
# Run only on Windows because on Linux there are no problems with slow package installation
47+
# Run only on Windows because on Linux there are no problems with slow package installation
6148
- name: 📥 Cache Bun dependencies (Windows)
6249
if: runner.os == 'Windows'
6350
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
64-
env:
65-
BUN_INSTALL_CACHE_DIR: ${{ runner.os == 'Windows' && env.WINDOWS_BUN_CACHE_DIR || '' }}
6651
with:
67-
path: ${{ env.BUN_INSTALL_CACHE_DIR }}
52+
path: ~\.bun
6853
key: ${{ matrix.os }}-bun-${{ hashFiles('**/bun.lock') }}
69-
restore-keys: ${{ matrix.os }}-bun-
54+
restore-keys: ${{ matrix.os }}-bun-cache-
7055

7156
- name: 📦 Install dependencies
72-
env:
73-
BUN_INSTALL_CACHE_DIR: ${{ runner.os == 'Windows' && env.WINDOWS_BUN_CACHE_DIR || '' }}
7457
run: bun install --production --frozen-lockfile --prefer-offline --ignore-scripts --omit=optional
7558

7659
- name: 🧪 Run tests

0 commit comments

Comments
 (0)