diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..74c40049e7e82bd99c5ce8c936741ccc547f089c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,59 @@ +variables: + GIT_SSL_NO_VERIFY: "1" + + # Commit of ghc/ci-images repository from which to pull Docker images + DOCKER_REV: 572353e0644044fe3a5465bba4342a9a0b0eb60e + + # Sequential version number of all cached things. + # Bump to invalidate GitLab CI cache. + CACHE_REV: 10 + + # Disable shallow clones; they break our linting rules + GIT_DEPTH: 0 + + # Always start with a fresh clone to avoid non-hermetic builds + GIT_STRATEGY: clone + +default: + interruptible: true + +stages: + - build + +workflow: + # N.B. Don't run on wip/ branches, instead on run on merge requests. + rules: + - if: $CI_MERGE_REQUEST_ID + - if: $CI_COMMIT_TAG + - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/' + - if: '$CI_PIPELINE_SOURCE == "web"' + +.version_matrix : &version_matrix + matrix: + - VERSION: 9.2.5 + - VERSION: 9.4.4 + - VERSION: 9.6.1 + +build-linux: + tags: + - x86_64-linux + parallel: *version_matrix + before_script: + - sudo chown ghc:ghc -R . + stage: build + image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV" + needs: [] + dependencies: [] + script: + - .gitlab/ci.sh + +build-windows: + tags: + - new-x86_64-windows + parallel: *version_matrix + needs: [] + dependencies: [] + stage: build + script: + - bash .gitlab/ci.sh diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh new file mode 100755 index 0000000000000000000000000000000000000000..6988357e68a5d862a5013873937db673eda19964 --- /dev/null +++ b/.gitlab/ci.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -x +set -eo pipefail + +runner_temp=$(mktemp -d) + +export GHCUP_INSTALL_BASE_PREFIX=$runner_temp/foobarbaz +export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 +export BOOTSTRAP_HASKELL_MINIMAL=1 +export BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 + +curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh + +source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env || source ~/.bashrc + +ghcup --version +which ghcup | grep foobarbaz + +ghcup install ghc --set $VERSION +ghcup install cabal + +cabal update +cabal build