Skip to content

Commit 895a4a2

Browse files
authored
Merge branch 'master' into nixpkgs-ghc-9.6
2 parents ce050b0 + 6e84dc8 commit 895a4a2

File tree

6 files changed

+102
-57
lines changed

6 files changed

+102
-57
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Authenticate with GitHub API
2+
description: |
3+
Authenticated GitHub API requests are not rate-limited like unauthenticated requests.
4+
5+
# For more details: https://github.com/tweag/rules_haskell/pull/1494
6+
7+
inputs:
8+
github_token:
9+
type: string
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- shell: bash
15+
env:
16+
GITHUB_TOKEN: ${{ inputs.github_token }}
17+
run: |
18+
cat >~/.netrc <<EOF
19+
machine api.github.com
20+
password ${GITHUB_TOKEN}
21+
EOF
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Free Disk Space on Linux
2+
description: Remove unneeded files from the Ubuntu GitHub runner.
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- shell: bash
8+
if: ${{ runner.os == 'Linux' }}
9+
run: |-
10+
sudo swapoff -a
11+
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
12+
docker rmi $(docker images -q) -f
13+
14+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Install Apt Packages
2+
description: Install packages via apt-get install.
3+
4+
inputs:
5+
packages:
6+
type: string
7+
description: A space-separated list of apt packages to install.
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- shell: bash
13+
if: ${{ runner.os == 'Linux' }}
14+
env:
15+
APT_PACKAGES: ${{ inputs.packages }}
16+
run: |-
17+
sudo apt-get update
18+
sudo apt-get install --no-install-recommends -yy "${APT_PACKAGES}"
19+
sudo apt clean
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Set the TCP keep-alive time
2+
description: Avoids deadline exceeded errors on Linux.
3+
4+
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
5+
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
6+
7+
inputs:
8+
tcp_keepalive_time:
9+
type: number
10+
description: The value to be set for the TCP keep-alive time.
11+
default: 60
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- shell: bash
17+
if: ${{ runner.os == 'Linux' }}
18+
env:
19+
TCP_KEEPALIVE_TIME: ${{ inputs.tcp_keepalive_time }}
20+
run: |-
21+
sudo sysctl -w "net.ipv4.tcp_keepalive_time=${TCP_KEEPALIVE_TIME}"

.github/workflows/renovate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v4
1313
- name: Run Renovate
14-
uses: renovatebot/github-action@v39.1.4
14+
uses: renovatebot/github-action@v39.2.1
1515
with:
1616
docker-cmd-file: .github/renovate.sh
1717
token: ${{ secrets.RENOVATE_TOKEN }}

.github/workflows/workflow.yaml

Lines changed: 26 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,36 @@ env:
1111
# Bump this number to invalidate the GH actions cache
1212
cache-version: 0
1313

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
17+
1418
jobs:
1519
lint:
1620
name: Format & Lint
17-
concurrency:
18-
group: ${{ github.workflow }}-${{ github.ref }}-lint
19-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
2021
runs-on: ubuntu-latest
2122
steps:
2223
- uses: actions/checkout@v4
2324
- uses: tweag/configure-bazel-remote-cache-auth@v0
2425
with:
2526
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
26-
bazelrc_path: .bazelrc.local
27+
bazelrc_path: .bazelrc.auth
28+
- uses: ./.github/actions/set_tcp_keepalive_time
29+
- uses: ./.github/actions/authenticate_github_api
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
2732
- name: Configure
2833
run: |
29-
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
30-
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
31-
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
3234
cat >>.bazelrc.local <<EOF
3335
common --config=ci
3436
EOF
35-
cat >~/.netrc <<EOF
36-
machine api.github.com
37-
password ${{ secrets.GITHUB_TOKEN }}
38-
EOF
3937
- run: |
4038
bazelisk test buildifier:buildifier_test
4139
4240
test-nixpkgs:
4341
name: Build & Test - Nixpkgs
4442
needs:
4543
- lint
46-
concurrency:
47-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.module }}-${{ matrix.bzlmod }}-${{ matrix.ghc }}-nixpkgs
48-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
4944
strategy:
5045
fail-fast: false
5146
matrix:
@@ -67,12 +62,8 @@ jobs:
6762
bzlmod: true
6863
runs-on: ${{ matrix.os }}
6964
steps:
70-
- if: ${{ matrix.os == 'ubuntu-latest' }}
71-
run: |-
72-
sudo swapoff -a
73-
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
74-
docker rmi $(docker images -q) -f
7565
- uses: actions/checkout@v4
66+
- uses: ./.github/actions/free_disk_space_on_linux
7667
- name: Mount Bazel cache
7768
uses: actions/cache@v3
7869
with:
@@ -88,11 +79,12 @@ jobs:
8879
with:
8980
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
9081
bazelrc_path: .bazelrc.auth
82+
- uses: ./.github/actions/set_tcp_keepalive_time
83+
- uses: ./.github/actions/authenticate_github_api
84+
with:
85+
github_token: ${{ secrets.GITHUB_TOKEN }}
9186
- name: Configure
9287
run: |
93-
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
94-
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
95-
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
9688
case ${{ runner.os }} in
9789
macOS) BUILD_CONFIG=ci-macos-nixpkgs;;
9890
Linux) BUILD_CONFIG=ci-linux-nixpkgs;;
@@ -104,10 +96,6 @@ jobs:
10496
EOF
10597
cp .bazelrc.local rules_haskell_nix
10698
cp .bazelrc.local rules_haskell_tests
107-
cat >~/.netrc <<EOF
108-
machine api.github.com
109-
password ${{ secrets.GITHUB_TOKEN }}
110-
EOF
11199
- name: Check Bazel version
112100
run: |
113101
nix-shell --arg docTools false --argstr ghcVersion ${{ matrix.ghc }} --pure --run .ci/check-bazel-version
@@ -147,9 +135,6 @@ jobs:
147135
name: Build & Test - bindist
148136
needs:
149137
- lint
150-
concurrency:
151-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.module }}-${{ matrix.bzlmod }}-${{ matrix.ghc }}-bindist
152-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
153138
strategy:
154139
fail-fast: false
155140
matrix:
@@ -178,15 +163,11 @@ jobs:
178163
GHC_VERSION: ${{ matrix.ghc }}
179164
runs-on: ${{ matrix.os }}
180165
steps:
181-
- if: ${{ matrix.os == 'ubuntu-latest' }}
182-
run: |-
183-
sudo swapoff -a
184-
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
185-
sudo apt-get update
186-
sudo apt-get install --no-install-recommends -yy libtinfo5
187-
sudo apt clean
188-
docker rmi $(docker images -q) -f
189166
- uses: actions/checkout@v4
167+
- uses: ./.github/actions/free_disk_space_on_linux
168+
- uses: ./.github/actions/install_apt_pkgs
169+
with:
170+
packages: libtinfo5
190171
- name: Mount Bazel cache
191172
uses: actions/cache@v3
192173
with:
@@ -202,12 +183,13 @@ jobs:
202183
with:
203184
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
204185
bazelrc_path: .bazelrc.auth
186+
- uses: ./.github/actions/set_tcp_keepalive_time
187+
- uses: ./.github/actions/authenticate_github_api
188+
with:
189+
github_token: ${{ secrets.GITHUB_TOKEN }}
205190
- name: Configure
206191
shell: bash
207192
run: |
208-
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
209-
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
210-
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
211193
case "${{ runner.os }},${{ matrix.module }}" in
212194
macOS,*) BUILD_CONFIG=ci-macos-bindist;;
213195
Linux,*) BUILD_CONFIG=ci-linux-bindist;;
@@ -235,33 +217,21 @@ jobs:
235217
common --enable_bzlmod=${{ matrix.bzlmod }}
236218
EOF
237219
cp .bazelrc.local rules_haskell_tests
238-
cat >~/.netrc <<EOF
239-
machine api.github.com
240-
password ${{ secrets.GITHUB_TOKEN }}
241-
EOF
242220
- name: Build & test - rules_haskell
243221
if: matrix.module == 'rules_haskell'
244222
shell: bash
245223
run: |
246-
if [[ ${{ runner.os }} == Windows ]]; then
247-
# On Windows `//...` expands to `/...`.
248-
bazel test ///...
249-
else
250-
bazel test //...
251-
fi
224+
# Quote the package specifier so that it works on Windows
225+
bazel test "//..."
252226
253227
- name: Build & test - rules_haskell_tests
254228
if: matrix.module == 'rules_haskell_tests'
255229
shell: bash
256230
run: |
257231
cd rules_haskell_tests
258232
./tests/run-start-script.sh --use-bindists --with-bzlmod=${{ matrix.bzlmod }}
259-
if [[ ${{ runner.os }} == Windows ]]; then
260-
# On Windows `//...` expands to `/...`.
261-
bazel test ///...
262-
else
263-
bazel test //...
264-
fi
233+
# Quote the package specifier so that it works on Windows
234+
bazel test "//..."
265235
# Test stack_snapshot pinning
266236
# NOTE keep in sync with tests/RunTests.hs
267237
bazel run @stackage-pinning-test-unpinned//:pin

0 commit comments

Comments
 (0)