Skip to content

Commit 466ea7c

Browse files
authored
Merge branch 'master' into dependabot/github_actions/renovatebot/github-action-39.2.0
2 parents ee42a6e + 60e7a0d commit 466ea7c

File tree

5 files changed

+100
-55
lines changed

5 files changed

+100
-55
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/workflow.yaml

Lines changed: 25 additions & 55 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 }}
2627
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:
@@ -64,12 +59,8 @@ jobs:
6459
bzlmod: true
6560
runs-on: ${{ matrix.os }}
6661
steps:
67-
- if: ${{ matrix.os == 'ubuntu-latest' }}
68-
run: |-
69-
sudo swapoff -a
70-
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
71-
docker rmi $(docker images -q) -f
7262
- uses: actions/checkout@v4
63+
- uses: ./.github/actions/free_disk_space_on_linux
7364
- name: Mount Bazel cache
7465
uses: actions/cache@v3
7566
with:
@@ -85,11 +76,12 @@ jobs:
8576
with:
8677
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
8778
bazelrc_path: .bazelrc.auth
79+
- uses: ./.github/actions/set_tcp_keepalive_time
80+
- uses: ./.github/actions/authenticate_github_api
81+
with:
82+
github_token: ${{ secrets.GITHUB_TOKEN }}
8883
- name: Configure
8984
run: |
90-
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
91-
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
92-
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
9385
case ${{ runner.os }} in
9486
macOS) BUILD_CONFIG=ci-macos-nixpkgs;;
9587
Linux) BUILD_CONFIG=ci-linux-nixpkgs;;
@@ -101,10 +93,6 @@ jobs:
10193
EOF
10294
cp .bazelrc.local rules_haskell_nix
10395
cp .bazelrc.local rules_haskell_tests
104-
cat >~/.netrc <<EOF
105-
machine api.github.com
106-
password ${{ secrets.GITHUB_TOKEN }}
107-
EOF
10896
- name: Check Bazel version
10997
run: |
11098
nix-shell --arg docTools false --argstr ghcVersion ${{ matrix.ghc }} --pure --run .ci/check-bazel-version
@@ -144,9 +132,6 @@ jobs:
144132
name: Build & Test - bindist
145133
needs:
146134
- lint
147-
concurrency:
148-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.module }}-${{ matrix.bzlmod }}-${{ matrix.ghc }}-bindist
149-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
150135
strategy:
151136
fail-fast: false
152137
matrix:
@@ -175,15 +160,11 @@ jobs:
175160
GHC_VERSION: ${{ matrix.ghc }}
176161
runs-on: ${{ matrix.os }}
177162
steps:
178-
- if: ${{ matrix.os == 'ubuntu-latest' }}
179-
run: |-
180-
sudo swapoff -a
181-
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
182-
sudo apt-get update
183-
sudo apt-get install --no-install-recommends -yy libtinfo5
184-
sudo apt clean
185-
docker rmi $(docker images -q) -f
186163
- uses: actions/checkout@v4
164+
- uses: ./.github/actions/free_disk_space_on_linux
165+
- uses: ./.github/actions/install_apt_pkgs
166+
with:
167+
packages: libtinfo5
187168
- name: Mount Bazel cache
188169
uses: actions/cache@v3
189170
with:
@@ -199,12 +180,13 @@ jobs:
199180
with:
200181
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
201182
bazelrc_path: .bazelrc.auth
183+
- uses: ./.github/actions/set_tcp_keepalive_time
184+
- uses: ./.github/actions/authenticate_github_api
185+
with:
186+
github_token: ${{ secrets.GITHUB_TOKEN }}
202187
- name: Configure
203188
shell: bash
204189
run: |
205-
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
206-
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
207-
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
208190
case "${{ runner.os }},${{ matrix.module }}" in
209191
macOS,*) BUILD_CONFIG=ci-macos-bindist;;
210192
Linux,*) BUILD_CONFIG=ci-linux-bindist;;
@@ -232,33 +214,21 @@ jobs:
232214
common --enable_bzlmod=${{ matrix.bzlmod }}
233215
EOF
234216
cp .bazelrc.local rules_haskell_tests
235-
cat >~/.netrc <<EOF
236-
machine api.github.com
237-
password ${{ secrets.GITHUB_TOKEN }}
238-
EOF
239217
- name: Build & test - rules_haskell
240218
if: matrix.module == 'rules_haskell'
241219
shell: bash
242220
run: |
243-
if [[ ${{ runner.os }} == Windows ]]; then
244-
# On Windows `//...` expands to `/...`.
245-
bazel test ///...
246-
else
247-
bazel test //...
248-
fi
221+
# Quote the package specifier so that it works on Windows
222+
bazel test "//..."
249223
250224
- name: Build & test - rules_haskell_tests
251225
if: matrix.module == 'rules_haskell_tests'
252226
shell: bash
253227
run: |
254228
cd rules_haskell_tests
255229
./tests/run-start-script.sh --use-bindists --with-bzlmod=${{ matrix.bzlmod }}
256-
if [[ ${{ runner.os }} == Windows ]]; then
257-
# On Windows `//...` expands to `/...`.
258-
bazel test ///...
259-
else
260-
bazel test //...
261-
fi
230+
# Quote the package specifier so that it works on Windows
231+
bazel test "//..."
262232
# Test stack_snapshot pinning
263233
# NOTE keep in sync with tests/RunTests.hs
264234
bazel run @stackage-pinning-test-unpinned//:pin

0 commit comments

Comments
 (0)