Skip to content

Commit ebe7646

Browse files
committed
CI: overcome rate-limits for GH downloads by providing access token
Also only run haskell tests on linux, toolchain takes 6 mins to install on macos
1 parent af10489 commit ebe7646

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/pytest.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Default is the full (os x batch) cross-product. `niche` (heavy/slow toolchains:
1616
# lean, ocaml, nix, julia, R, perl) is ubuntu-only via matrix.exclude -- not worth
1717
# the Windows/macOS cost. An OS-specific *language* inside an otherwise all-OS
18-
# batch (swift -> macOS, haskell -> not Windows) is skipped one level down by the
18+
# batch (swift -> macOS, haskell -> Linux only) is skipped one level down by the
1919
# central conftest guard, NOT by the matrix.
2020
#
2121
# CONCURRENCY LIMITS (GitHub free tier)
@@ -64,7 +64,8 @@ jobs:
6464
env:
6565
MARKERS_JVM: "java or csharp or fsharp or kotlin or scala or groovy or clojure or bsl"
6666
MARKERS_NATIVE: "cpp or rust or go or zig or pascal or swift" # swift is macOS-only (skips elsewhere via the guard)
67-
# other-langs: grab-bag + scripting languages + haskell (haskell skips on Windows via the guard)
67+
# other-langs: grab-bag + scripting languages + haskell. Haskell (GHC/HLS) is installed only on
68+
# Linux -- it's too slow/expensive to build on the macOS runner -- and skips on Windows+macOS via the guard.
6869
MARKERS_OTHER_LANGS: "ruby or php or lua or luau or bash or powershell or elixir or erlang or dart or haxe or haskell or terraform or rego or ansible or yaml or toml or markdown or latex or crystal or cue or fortran or ada or matlab or systemverilog or hlsl or msl or al"
6970
# niche: slow, mostly-cached toolchains. ocaml + haskell are the two slowest -- kept in separate
7071
# batches (ocaml here, haskell in other-langs). nix + perl skip on Windows via the guard.
@@ -521,14 +522,14 @@ jobs:
521522
fi
522523
# --- Slow / heavy language toolchains, each isolated in its own batch (OS gating via matrix excludes) ---
523524
- name: Setup Haskell toolchain
524-
if: matrix.batch == 'other-langs' && runner.os != 'Windows'
525+
if: matrix.batch == 'other-langs' && runner.os == 'Linux'
525526
uses: haskell/ghcup-setup@v1
526527
with:
527528
ghc: '9.12.2'
528529
cabal: '3.10.3.0'
529530
hls: '2.11.0.0'
530531
- name: Verify Haskell tools
531-
if: matrix.batch == 'other-langs' && runner.os != 'Windows'
532+
if: matrix.batch == 'other-langs' && runner.os == 'Linux'
532533
shell: bash
533534
run: |
534535
which ghc && ghc --version
@@ -539,7 +540,7 @@ jobs:
539540
echo "WARNING: haskell-language-server-wrapper not found (may be incompatible with GHC 9.12.2)"
540541
fi
541542
- name: Pre-build Haskell test project for HLS
542-
if: matrix.batch == 'other-langs' && runner.os != 'Windows'
543+
if: matrix.batch == 'other-langs' && runner.os == 'Linux'
543544
shell: bash
544545
run: |
545546
cd test/resources/repos/haskell/test_repo
@@ -569,11 +570,22 @@ jobs:
569570
uses: cachix/install-nix-action@v30
570571
with:
571572
nix_path: nixpkgs=channel:nixos-unstable
573+
# Authenticate any GitHub fetch Nix makes during evaluation/tests with the runner's
574+
# GITHUB_TOKEN (raises the unauthenticated 60 req/hr-per-IP API limit to ~1000/hr).
575+
# nixd itself is installed from the channel below, so this is just insurance.
576+
extra_nix_config: |
577+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
572578
- name: Install nixd (Nix Language Server)
573579
if: matrix.batch == 'niche' && runner.os != 'Windows'
574580
shell: bash
575581
run: |
576-
nix profile install github:nix-community/nixd
582+
# Install nixd from the nixos-unstable channel (set as <nixpkgs> on NIX_PATH via nix_path
583+
# above) using classic nix-env. `-f '<nixpkgs>'` resolves the channel tarball from
584+
# nixos.org and selects the `nixd` attribute -- it never touches the GitHub API. (The flake
585+
# form `nix profile install github:nix-community/nixd` resolves an unpinned HEAD through
586+
# api.github.com/.../commits/HEAD, which GitHub 429-throttles on CI even with a token;
587+
# and `nix-env -iA nixpkgs.nixd` fails here because no channel named `nixpkgs` is registered.)
588+
nix-env -f '<nixpkgs>' -iA nixd
577589
if ! command -v nixd &> /dev/null; then
578590
echo "nixd installation failed or not in PATH"; exit 1
579591
fi

0 commit comments

Comments
 (0)