Skip to content

Commit

Permalink
CI: Introduce "Format & Lint" job
Browse files Browse the repository at this point in the history
There is no need to build and run buildifier for each module and for every
GHC version in order to keep the code base in shape.

Tag the buildifier tests with `manual` and only run the buildifier for the
top-level repository (which formats / lints all files of the git repo).
  • Loading branch information
avdv committed Nov 23, 2023
1 parent f1548c6 commit 455fdce
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,41 @@ env:
cache-version: 0

jobs:
lint:
name: Format & Lint
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-lint
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
if [ -z "$BUILDBUDDY_API_KEY" ]; then
cache_setting='--noremote_upload_local_results'
else
cache_setting="--remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY"
fi
cat >.bazelrc.local <<EOF
common --config=ci
build $cache_setting
EOF
cat >~/.netrc <<EOF
machine api.github.com
password ${{ secrets.GITHUB_TOKEN }}
EOF
- run: |
bazelisk test buildifier:buildifier_test
test-nixpkgs:
name: Build & Test - Nixpkgs
needs:
- lint
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.module }}-${{ matrix.bzlmod }}-${{ matrix.ghc }}-nixpkgs
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
Expand Down Expand Up @@ -115,6 +148,8 @@ jobs:
test-bindist:
name: Build & Test - bindist
needs:
- lint
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.module }}-${{ matrix.bzlmod }}-${{ matrix.ghc }}-bindist
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
Expand Down
1 change: 1 addition & 0 deletions buildifier/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ buildifier_test(
mode = "diff",
tags = [
"dont_test_on_windows",
"manual",
],
)

Expand Down
1 change: 1 addition & 0 deletions rules_haskell_nix/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildifier_test(
buildifier = "@buildifier//:buildifier",
tags = [
"dont_test_on_windows",
"manual",
],
verbose = True,
)
1 change: 1 addition & 0 deletions rules_haskell_tests/buildifier/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ buildifier_test(
mode = "diff",
tags = [
"dont_test_on_windows",
"manual",
],
)

Expand Down

0 comments on commit 455fdce

Please sign in to comment.