Skip to content

Commit

Permalink
Merge pull request #1502 from tweag/gh-actions-windows
Browse files Browse the repository at this point in the history
Port Windows CI to Github actions
  • Loading branch information
mboes authored Feb 28, 2021
2 parents 76de616 + bdad042 commit 60ed30a
Show file tree
Hide file tree
Showing 28 changed files with 162 additions and 132 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ build:macos-nixpkgs --test_tag_filters -dont_test_on_darwin
build:macos-bindist --build_tag_filters -requires_nix,-dont_test_on_darwin,-dont_test_on_darwin_with_bindist,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
build:macos-bindist --test_tag_filters -requires_nix,-dont_test_on_darwin,-dont_test_on_darwin_with_bindist,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist

build:windows-bindist --build_tag_filters -requires_nix,-dont_test_on_windows,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
build:windows-bindist --test_tag_filters -requires_nix,-dont_test_on_windows,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist

# CI Configuration
# ----------------
common:ci --color=no
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
os: [ubuntu, macos, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -69,16 +69,19 @@ jobs:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }}
- name: Install Bazel
shell: bash
run: |
BAZEL_DIR="$(.ci/fetch-bazel-bindist)"
mv $BAZEL_DIR $HOME/bazel
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
shell: bash
run: |
case ${{ matrix.os }} in
macos) BUILD_CONFIG=macos-bindist;;
ubuntu) BUILD_CONFIG=linux-bindist;;
windows) BUILD_CONFIG=windows-bindist;;
esac
cat >.bazelrc.local <<EOF
common --config=ci
Expand All @@ -90,6 +93,7 @@ jobs:
password ${{ secrets.GITHUB_TOKEN }}
EOF
- name: Build & test
shell: bash
run: |
export PATH=$HOME/bazel:$PATH
[[ ${{ matrix.os }} == macos ]] && export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
Expand Down
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pull_request_rules:
- 'status-success~=Build & Test - Nixpkgs \(macos\).*'
- 'status-success~=Build & Test - bindist \(ubuntu\).*'
- 'status-success~=Build & Test - bindist \(macos\).*'
- "status-success=tweag.rules_haskell"
- 'status-success~=Build & Test - bindist \(windows\).*'
- "status-success=deploy/netlify"
- "#approved-reviews-by>=1"
- "label=merge-queue"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Haskell rules for [Bazel][bazel]

[![Continuous integration](https://github.com/tweag/rules_haskell/workflows/Continuous%20integration/badge.svg)](https://github.com/tweag/rules_haskell/actions?query=branch%3Amaster)
[![Build Status](https://dev.azure.com/tweag/rules_haskell/_apis/build/status/tweag.rules_haskell?branchName=master)](https://dev.azure.com/tweag/rules_haskell/_build/latest?definitionId=1?branchName=master)

Bazel automates building and testing software. It scales to very large
multi-language projects. This project extends Bazel with build rules
Expand Down
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ stack_snapshot(
],
setup_deps = {"polysemy": ["cabal-doctest"]},
snapshot = test_stack_snapshot,
stack_snapshot_json = "//:stackage_snapshot.json",
stack_snapshot_json = "//:stackage_snapshot.json" if not is_windows else None,
tools = [
# This is not required, as `stack_snapshot` would build alex
# automatically, however it is used as a test for user provided
Expand All @@ -106,14 +106,14 @@ stack_snapshot(
extra_deps = {"zlib": ["//tests:zlib"]},
packages = ["zlib"],
snapshot = test_stack_snapshot,
stack_snapshot_json = "//:stackage-zlib-snapshot.json",
stack_snapshot_json = "//:stackage-zlib-snapshot.json" if not is_windows else None,
)

stack_snapshot(
name = "stackage-pinning-test",
local_snapshot = "//:stackage-pinning-test.yaml",
packages = ["hspec"],
stack_snapshot_json = "//:stackage-pinning-test_snapshot.json",
stack_snapshot_json = "//:stackage-pinning-test_snapshot.json" if not is_windows else None,
)

stack_snapshot(
Expand All @@ -126,7 +126,7 @@ stack_snapshot(
haddock = False,
local_snapshot = "//:ghcide-stack-snapshot.yaml",
packages = ["ghcide"],
stack_snapshot_json = "//:ghcide-snapshot.json",
stack_snapshot_json = "//:ghcide-snapshot.json" if not is_windows else None,
)

load(
Expand Down
92 changes: 0 additions & 92 deletions azure-pipelines.yml

This file was deleted.

13 changes: 13 additions & 0 deletions haskell/ghc_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,19 @@ def _ghc_bindist_impl(ctx):
execute_or_fail_loudly(ctx, ["rm", "mingw/x86_64-w64-mingw32/lib/libpthread.dll.a"])
execute_or_fail_loudly(ctx, ["rm", "mingw/x86_64-w64-mingw32/lib/libwinpthread.dll.a"])

# Similarly causes loading issues with template Haskell. E.g.
#
# ghc.exe: panic! (the 'impossible' happened)
# (GHC version 8.6.5 for x86_64-unknown-mingw32):
# loadArchive "C:\\Users\\runneradmin\\_bazel_runneradmin\\minshlu6\\external\\rules_haskell_ghc_windows_amd64\\mingw\\lib\\libz.dll.a": failed
#
# Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
#
# ghc.exe: Could not load `zlib1.dll'. Reason: addDLL: zlib1.dll or dependencies not loaded. (Win32 error 126)
#
# on //tests/haddock:haddock-lib-b.
execute_or_fail_loudly(ctx, ["rm", "mingw/lib/libz.dll.a"])

# We apply some patches, if needed.
patch(ctx)

Expand Down
3 changes: 3 additions & 0 deletions haskell/haddock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ def _haskell_doc_aspect_impl(target, ctx):

# TODO(mboes): we should be able to instantiate this template only
# once per toolchain instance, rather than here.
# TODO(aherrmann): Convert to a standalone sh_binary.
# Executable shell script files don't work on Windows.
# This fails with `%1 is not a valid Win32 application.`.
haddock_wrapper = ctx.actions.declare_file("haddock_wrapper-{}".format(hs.name))
ctx.actions.expand_template(
template = ctx.file._haddock_wrapper_tpl,
Expand Down
6 changes: 3 additions & 3 deletions haskell/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def rules_haskell_dependencies():
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
strip_prefix = "protobuf-3.14.0",
sha256 = "f18a40816260a9a3190a94efb0fc26270b244a2436681602f0a944739095d632",
strip_prefix = "protobuf-3.15.1",
urls = [
"https://github.com/google/protobuf/archive/v3.14.0.tar.gz",
"https://github.com/google/protobuf/archive/v3.15.1.tar.gz",
],
)

Expand Down
1 change: 1 addition & 0 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ build:ci --jobs=2
build:ci --verbose_failures
common:ci --color=no
test:ci --test_output=errors
build:ci-windows --crosstool_top=@rules_haskell_ghc_windows_amd64//:cc_toolchain
$(insert_if_equal $mode "nix" '
# This project uses a GHC provisioned via nix.
Expand Down
Loading

0 comments on commit 60ed30a

Please sign in to comment.