Skip to content

Commit

Permalink
Merge pull request #68 from tweag/bzlmod-ghc-versions
Browse files Browse the repository at this point in the history
Test multiple GHC versions with bzlmod.
  • Loading branch information
mergify[bot] authored Oct 16, 2023
2 parents 37370de + 65b47f5 commit 07e2ac7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
ghc-version: [ghc_8_10_7, ghc_9_0_2, ghc_9_2_7, ghc_9_4_5]
enable-bzlmod: [false]
include:
- os: ubuntu-latest
ghc-version: ghc_9_2_7
enable-bzlmod: true
- os: ubuntu-latest
ghc-version: ghc_9_4_5
enable-bzlmod: true
Expand All @@ -43,9 +46,14 @@ jobs:
cache_setting="--remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY"
fi
# Convert "ghc_X_Y_Z" to "X.Y.Z".
GHC_VERSION="$(sed 's/^ghc_//;s/_/./g' <<<"${{ matrix.ghc-version }}")"
bzlmod_setting=
if [[ ${{ matrix.enable-bzlmod }} = true ]]; then
bzlmod_setting="common --config=bzlmod"
# Update the GHC_VERSION in MODULE.bazel
sed -i.bak 's/^GHC_VERSION = .*$/GHC_VERSION = "'"$GHC_VERSION"'"/g' example/MODULE.bazel
fi
cat >.bazelrc.local <<EOF
Expand Down
8 changes: 5 additions & 3 deletions example/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ bazel_dep(name = "rules_haskell_nix")
bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle")

GHC_VERSION = "9.4.5"

stack_snapshot = use_extension(
"@rules_haskell//extensions:stack_snapshot.bzl",
"stack_snapshot",
)
use_repo(stack_snapshot, "stackage", "stackage-exe")
stack_snapshot.snapshot(local_snapshot = "@io_tweag_gazelle_cabal//:snapshot-%s.yaml" % GHC_VERSION)
# TODO these should be generated by Gazelle
stack_snapshot.package(name = "base")
stack_snapshot.package(name = "inspection-testing")
Expand All @@ -35,7 +38,6 @@ nix_haskell_toolchains = use_extension(
"nix_haskell_toolchains",
)

GHC_VERSION = "9.4.5"
nix_haskell_toolchains.new(
attribute_path = "haskell.compiler.ghc" + GHC_VERSION.replace(".", ""),
repository = "@nixpkgs",
Expand Down Expand Up @@ -64,8 +66,8 @@ register_toolchains(
)

# TODO Remove once rules_haskell is in the BCR.
RULES_HASKELL_REV = "155ba21c7d315cc421ee3f17a1c09b758cc7279d"
RULES_HASKELL_INTEGRITY = "sha384-dIsFufYml0KGSUiC6jhY9ClMv/yEW1kGof7fLahSwfbWd28jLiwMGBGUuoOsQwWf"
RULES_HASKELL_REV = "25831a7a3313fbadb6dbd166fca20ced6c38a1d1"
RULES_HASKELL_INTEGRITY = "sha384-U+jg9U1fF4ibW5TDzj6UruKqD9ELsUA60QEO1MMTxbgG1BJnh0+JbQd3BcTHroSn"
archive_override(
module_name = "rules_haskell",
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % RULES_HASKELL_REV],
Expand Down

0 comments on commit 07e2ac7

Please sign in to comment.