diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000000..201d9256f27 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,23 @@ +freebsd_instance: + image_family: freebsd-13-1 + disk: 100 + +task: + timeout_in: 120m + env: + AWS_ACCESS_KEY_ID: ENCRYPTED[7e381ce808bf572cdde8ea4b7023d06b631844d3dabfdb193b15e76a78555ad7f605afc34d8a51c69ab1b277c3c2e304] + AWS_SECRET_ACCESS_KEY: ENCRYPTED[640639db00f954f466c90613b79ae3b364268cd153c7e4f8cab16c75c2bdf72c9ffe18f14b4f0ae2fc0bdf21beadb3f2] + S3_HOST: ENCRYPTED[ef3162480f5b404ac20c12fb8cb55b664102463cea1b49cec4260b67e22f0b4b8da51c9c547a5c3da8ef22146459e324] + TARBALL_EXT: "tar.xz" + ARCH: 64 + ARTIFACT: "x86_64-freebsd" + DISTRO: "na" + RUNNER_OS: "FreeBSD" + ADD_CABAL_ARGS: "--enable-split-sections" + GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR} + install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf + script: + - bash .github/scripts/build.sh + binaries_artifacts: + path: "out/*" + diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh new file mode 100644 index 00000000000..5fc2372e088 --- /dev/null +++ b/.github/scripts/build.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -eux + +. .github/scripts/prereq.sh +. .github/scripts/common.sh + + +# ensure ghcup +if ! command -v ghcup ; then + install_ghcup +fi + +# ensure cabal-cache +if ! cabal-cache version ; then + download_cabal_cache "$HOME/.local/bin/cabal-cache" +fi + + +# build +ecabal update + +case "$(uname)" in + MSYS_*|MINGW*) + for ghc in $(cat bindist/ghcs-Msys) ; do + GHC_VERSION="${ghc%,*}" + args=( -O2 -w "ghc-$GHC_VERSION" --project-file cabal.project --disable-profiling --disable-tests --enable-executable-stripping ${ADD_CABAL_ARGS}) + ghcup install ghc "${GHC_VERSION}" + "ghc-${GHC_VERSION}" --info + # Shorten binary names + sed -i.bak -e 's/haskell-language-server/hls/g' \ + -e 's/haskell_language_server/hls/g' \ + haskell-language-server.cabal cabal.project + sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ + src/**/*.hs exe/*.hs + + + # shellcheck disable=SC2068 + build_with_cache ${args[@]} exe:hls exe:hls-wrapper + + mkdir -p "$CI_PROJECT_DIR/out" + + # shellcheck disable=SC2068 + cp "$(cabal list-bin -v0 ${args[@]} exe:hls)" "$CI_PROJECT_DIR/out/haskell-language-server-${GHC_VERSION}"${ext} + # shellcheck disable=SC2068 + cp "$(cabal list-bin -v0 ${args[@]} exe:hls-wrapper)" "$CI_PROJECT_DIR/out/haskell-language-server-wrapper"${ext} + ghcup rm ghc "${GHC_VERSION}" + done + ;; + *) + sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project + emake --version + emake GHCUP=ghcup CABAL_CACHE_BIN=cabal-cache S3_HOST="${S3_HOST}" S3_KEY="${ARTIFACT}" hls + emake GHCUP=ghcup bindist + rm -rf out/*.*.* + ;; +esac + +cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json" + + +# create tarball/zip +TARBALL_PREFIX="haskell-language-server" +case "${TARBALL_EXT}" in + zip) + HLS_VERSION="$("$CI_PROJECT_DIR/out/haskell-language-server-8.10.7" --numeric-version)" + cd "$CI_PROJECT_DIR/out/" + zip "${TARBALL_PREFIX}-${HLS_VERSION}-${ARTIFACT}.zip" haskell-language-server-* + find . -type f ! -name '*.zip' -delete + ;; + tar.xz) + emake --version + HLS_VERSION="$(emake -s -C out/bindist/haskell-language-server-* version)" + emake TARBALL="${TARBALL_PREFIX}-${HLS_VERSION}-${ARTIFACT}.tar.xz" bindist-tar + rm -rf out/bindist + ;; + *) + fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" + ;; +esac + diff --git a/.github/scripts/common.sh b/.github/scripts/common.sh new file mode 100644 index 00000000000..e9aaac38848 --- /dev/null +++ b/.github/scripts/common.sh @@ -0,0 +1,231 @@ +#!/bin/sh + +if [ "${RUNNER_OS}" = "Windows" ] ; then + ext=".exe" +else + ext='' +fi + +# Colors +BLACK="0;30" +GRAY="1;30" +RED="0;31" +LT_RED="1;31" +BROWN="0;33" +LT_BROWN="1;33" +GREEN="0;32" +LT_GREEN="1;32" +BLUE="0;34" +LT_BLUE="1;34" +PURPLE="0;35" +LT_PURPLE="1;35" +CYAN="0;36" +LT_CYAN="1;36" +WHITE="1;37" +LT_GRAY="0;37" + +ecabal() { + cabal "$@" +} + +sync_from() { + if [ "${RUNNER_OS}" != "Windows" ] ; then + cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store" + fi + + cabal-cache sync-from-archive \ + --host-name-override="${S3_HOST}" \ + --host-port-override=443 \ + --host-ssl-override=True \ + --region us-west-2 \ + $([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \ + --archive-uri "s3://haskell-language-server/${ARTIFACT}" +} + +sync_to() { + if [ "${RUNNER_OS}" != "Windows" ] ; then + cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store" + fi + + cabal-cache sync-to-archive \ + --host-name-override="${S3_HOST}" \ + --host-port-override=443 \ + --host-ssl-override=True \ + --region us-west-2 \ + $([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \ + --archive-uri "s3://haskell-language-server/${ARTIFACT}" +} + +raw_eghcup() { + "$GHCUP_BIN/ghcup${ext}" -v -c "$@" +} + +eghcup() { + if [ "${OS}" = "Windows" ] ; then + "$GHCUP_BIN/ghcup${ext}" -c -s "file:/$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$@" + else + "$GHCUP_BIN/ghcup${ext}" -c -s "file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$@" + fi +} + +sha_sum() { + if [ "${OS}" = "FreeBSD" ] ; then + sha256 "$@" + else + sha256sum "$@" + fi + +} + +git_describe() { + git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" + git describe --always +} + +download_cabal_cache() { + ( + set -e + dest="$HOME/.local/bin/cabal-cache" + url="" + exe="" + cd /tmp + case "${RUNNER_OS}" in + "Linux") + case "${DISTRO}" in + "Alpine") + case "${ARCH}" in + "32") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/i386-linux-alpine-cabal-cache-1.0.5.1 + ;; + "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-linux-alpine-static-cabal-cache-1.0.5.1 + ;; + esac + ;; + *) + case "${ARCH}" in + "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-linux-alpine-static-cabal-cache-1.0.5.1 + ;; + "ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/aarch64-linux-cabal-cache-1.0.5.1 + ;; + "ARM") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/armv7-linux-cabal-cache-1.0.5.1 + ;; + esac + ;; + esac + ;; + "FreeBSD") + url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-freebsd-cabal-cache-1.0.5.1 + ;; + "Windows") + exe=".exe" + url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-mingw64-cabal-cache-1.0.5.1.exe + ;; + "macOS") + case "${ARCH}" in + "ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/aarch64-apple-darwin-cabal-cache-1.0.5.1 + ;; + "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-apple-darwin-cabal-cache-1.0.5.1 + ;; + esac + ;; + esac + + if [ -n "${url}" ] ; then + case "${url##*.}" in + "gz") + curl -L -o - "${url}" | gunzip > cabal-cache${exe} + ;; + *) + curl -o cabal-cache${exe} -L "${url}" + ;; + esac + chmod +x cabal-cache${exe} + cp "cabal-cache${exe}" "${dest}${exe}" + fi + ) +} + +build_with_cache() { + ecabal configure "$@" + ecabal build --dependencies-only "$@" --dry-run + sync_from + ecabal build --dependencies-only "$@" || sync_to + sync_to + ecabal build "$@" + sync_to +} + +install_ghcup() { + find "$GHCUP_INSTALL_BASE_PREFIX" + mkdir -p "$GHCUP_BIN" + mkdir -p "$GHCUP_BIN"/../cache + + if [ "${RUNNER_OS}" = "FreeBSD" ] ; then + curl -o ghcup https://downloads.haskell.org/ghcup/tmp/x86_64-portbld-freebsd-ghcup-0.1.18.1 + chmod +x ghcup + mv ghcup "$HOME/.local/bin/ghcup" + else + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh + fi +} + +strip_binary() { + ( + set -e + binary=$1 + if [ "${RUNNER_OS}" = "macOS" ] ; then + strip "${binary}" + else + if [ "${RUNNER_OS}" != "Windows" ] ; then + strip -s "${binary}" + fi + fi + ) +} + +# GitLab Pipelines log section delimiters +# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664 +start_section() { + name="$1" + echo -e "section_start:$(date +%s):$name\015\033[0K" +} + +end_section() { + name="$1" + echo -e "section_end:$(date +%s):$name\015\033[0K" +} + +echo_color() { + local color="$1" + local msg="$2" + echo -e "\033[${color}m${msg}\033[0m" +} + +error() { echo_color "${RED}" "$1"; } +warn() { echo_color "${LT_BROWN}" "$1"; } +info() { echo_color "${LT_BLUE}" "$1"; } + +fail() { error "error: $1"; exit 1; } + +run() { + info "Running $*..." + "$@" || ( error "$* failed"; return 1; ) +} + +emake() { + if command -v gmake >/dev/null 2>&1 ; then + gmake "$@" + else + make "$@" + fi +} + +mktempdir() { + case "$(uname -s)" in + "Darwin"|"darwin") + mktemp -d -t hls_ci.XXXXXXX + ;; + *) + mktemp -d + ;; + esac +} diff --git a/.github/scripts/prereq.sh b/.github/scripts/prereq.sh new file mode 100644 index 00000000000..fddc859ba58 --- /dev/null +++ b/.github/scripts/prereq.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +mkdir -p "$HOME"/.local/bin + +export PATH="$HOME/.local/bin:$PATH" + +export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 +export BOOTSTRAP_HASKELL_GHC_VERSION="${GHC_VER:-recommended}" +export BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL_VER:-recommended}" +export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes + +if [ "${RUNNER_OS}" = "Windows" ] ; then + # on windows use pwd to get unix style path + CI_PROJECT_DIR="$(pwd)" + export CI_PROJECT_DIR + export GHCUP_INSTALL_BASE_PREFIX="/c" + export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin" + export PATH="$GHCUP_BIN:$PATH" + export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal" +else + export CI_PROJECT_DIR="${GITHUB_WORKSPACE}" + export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR" + export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin" + export PATH="$GHCUP_BIN:$PATH" + export CABAL_DIR="$CI_PROJECT_DIR/cabal" + export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache" +fi + +export DEBIAN_FRONTEND=noninteractive +export TZ=Asia/Singapore + +if [ "${RUNNER_OS}" = "macOS" ] ; then + if ! command -v brew ; then + [ -e "$HOME/.brew" ] || + git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew" + export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH" + brew update + fi + if ! command -v git ; then + brew install git + fi + if ! command -v realpath ; then + brew install coreutils + fi + + brew install autoconf automake make tree + if [ "${ARCH}" = "ARM64" ] ; then + brew install llvm@11 + export PATH="$HOME/.brew/opt/llvm@11/bin:$PATH" + export CC="$HOME/.brew/opt/llvm@11/bin/clang" + export CXX="$HOME/.brew/opt/llvm@11/bin/clang++" + export LD=ld + export AR="$HOME/.brew/opt/llvm@11/bin/llvm-ar" + export RANLIB="$HOME/.brew/opt/llvm@11/bin/llvm-ranlib" + fi +fi + diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml deleted file mode 100644 index 02e05fb9244..00000000000 --- a/.github/workflows/bench.yml +++ /dev/null @@ -1,173 +0,0 @@ -name: Benchmark - -defaults: - run: - shell: bash - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - pull_request: - branches: - - '**' - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths_ignore: '[ "**/docs/**" - , "**.md" - , "**/LICENSE" - , ".circleci/**" - , "**.nix" - , "**/test/**" - , "flake.lock" - , "**/README.md" - , "FUNDING.yml" - , "**/stack*.yaml" - , ".gitlab-ci.yaml" - , ".gitlab/**" - ]' - - bench_init: - if: needs.pre_job.outputs.should_skip != 'true' - needs: pre_job - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - ghc: ['8.10.7', '9.2.5'] - os: [ubuntu-latest] - - # This code is fitted to the strategy: assumes Linux is used ... etc, - # change of the strategy may require changing the bootstrapping/run code - - steps: - - uses: actions/checkout@v3 - - - run: git fetch origin master # check the master branch for benchmarking - - - uses: ./.github/actions/setup-build - with: - ghc: ${{ matrix.ghc }} - os: ${{ runner.os }} - shorten-hls: "false" - - # max-backjumps is increased as a temporary solution - # for dependency resolution failure - - run: cabal configure --enable-benchmarks --max-backjumps 12000 - - - name: Build - run: cabal build haskell-language-server:benchmark - - - name: Bench init - run: cabal bench -j --benchmark-options="all-binaries" - - # tar is required to preserve file permissions - # compression speeds up upload/download nicely - - name: tar workspace - run: tar -czf workspace.tar.gz * .git - - - name: tar cabal - run: | - cd ~/.cabal - tar -czf cabal.tar.gz * - - - name: Upload workspace - uses: actions/upload-artifact@v3 - with: - name: workspace-${{ matrix.ghc }}-${{ matrix.os }} - retention-days: 1 - path: workspace.tar.gz - - - name: Upload .cabal - uses: actions/upload-artifact@v3 - with: - name: cabal-home-${{ matrix.ghc }}-${{ matrix.os }} - retention-days: 1 - path: ~/.cabal/cabal.tar.gz - - bench_example: - needs: [bench_init, pre_job] - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - ghc: ['8.10.7', '9.2.5'] - os: [ubuntu-latest] - cabal: ['3.6'] - example: ['cabal', 'lsp-types'] - - steps: - - uses: haskell/actions/setup@v2 - with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - name: Download cabal home - uses: actions/download-artifact@v3 - with: - name: cabal-home-${{ matrix.ghc }}-${{ matrix.os }} - path: . - - - name: Download workspace - uses: actions/download-artifact@v3 - with: - name: workspace-${{ matrix.ghc }}-${{ matrix.os }} - path: . - - - name: untar - run: | - mkdir -p ~/.cabal - tar xzf workspace.tar.gz - tar xzf cabal.tar.gz --directory ~/.cabal - - - name: Bench - run: cabal bench -j --benchmark-options="${{ matrix.example }}" - - - name: Display results - run: | - column -s, -t < bench-results/unprofiled/${{ matrix.example }}/results.csv | tee bench-results/unprofiled/${{ matrix.example }}/results.txt - - - name: tar benchmarking artifacts - run: find bench-results -name "*.csv" -or -name "*.svg" -or -name "*.html" | xargs tar -czf benchmark-artifacts.tar.gz - - - name: Archive benchmarking artifacts - uses: actions/upload-artifact@v3 - with: - name: bench-results-${{ matrix.example }}-${{ runner.os }}-${{ matrix.ghc }} - path: benchmark-artifacts.tar.gz - - - name: tar benchmarking logs - # We dont' store the eventlogs because the CI workers risk running out of disk space - run: find bench-results -name "*.log" -or -name "*.hp" | xargs tar -czf benchmark-logs.tar.gz - - - name: Archive benchmark logs - uses: actions/upload-artifact@v3 - with: - name: bench-logs-${{ matrix.example }}-${{ runner.os }}-${{ matrix.ghc }} - path: benchmark-logs.tar.gz - - bench_post_job: - if: always() - runs-on: ubuntu-latest - needs: [pre_job, bench_init, bench_example] - steps: - - run: | - echo "jobs info: ${{ toJSON(needs) }}" - - if: contains(needs.*.result, 'failure') - run: exit 1 - - if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true' - run: exit 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index b7e86269290..00000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,174 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - version: - description: 'HLS version' - required: true - type: string - tag: - description: 'HLS tag' - required: false - type: string - project: - description: 'Gitlab project number' - type: number - required: false - default: 1180 - release: - types: [created] - -jobs: - # generates a custom tarball with sources, used by `ghcup compile hls` - src-tar: - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v3 - - - name: Set hls release version - run: | - HLS_VER="${{ github.event.release.tag_name }}" - if [[ -z $HLS_VER ]]; then - HLS_VER=${{ github.sha }} - HLS_VER=${HLS_VER:0:5} - fi - echo "HLS_VER=$HLS_VER" >> $GITHUB_ENV - - - name: Create source tarball - run: | - mkdir src-dist - git archive --prefix=haskell-language-server-${{ env.HLS_VER }}/ \ - --format=tar.gz \ - -o src-dist/haskell-language-server.tar.gz \ - HEAD - - - name: Upload source tarball to the release - if: ${{ github.event.release.upload_url != '' }} - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: src-dist/haskell-language-server.tar.gz - asset_name: haskell-language-server-${{ env.HLS_VER }}-src.tar.gz - asset_content_type: application/gzip - - - name: Upload source tarball to workflow artifacts - uses: actions/upload-artifact@v3 - with: - name: haskell-language-server-${{ env.HLS_VER }}-src.tar.gz - path: src-dist/haskell-language-server.tar.gz - - # this generates .gz tarfiles containing binaries for all GHC versions and OS's - # used by `ghcup install hls` - tar: - runs-on: ubuntu-latest - steps: - - name: Download tarballs from gitlab - run: | - set -eux - - if [ -n "${{ github.event.inputs.project }}" ] ; then - proj=${{ github.event.inputs.project }} - else - proj=1180 - fi - - if [ -n "${{ github.event.release.tag_name }}" ] ; then - tag=${{ github.event.release.tag_name }} - ver=${tag#v} - elif [ -n "${{ github.event.inputs.version }}" ] ; then - ver=${{ github.event.inputs.version }} - if [ -n "${{ github.event.inputs.tag }}" ] ; then - tag=${{ github.event.inputs.tag }} - else - tag=v${ver} - fi - fi - - base_url="https://gitlab.haskell.org/api/v4/projects/${proj}/jobs/artifacts/${tag}/raw" - - # unix like platforms - for plat in aarch64-apple-darwin \ - aarch64-deb10-linux \ - armv7-deb10-linux \ - x86_64-apple-darwin \ - x86_64-unknown-freebsd12 \ - x86_64-unknown-freebsd13 \ - x86_64-alpine3.12-linux \ - x86_64-centos7-linux \ - x86_64-deb9-linux \ - x86_64-deb10-linux \ - x86_64-fedora27-linux ; do - url="${base_url}/out/haskell-language-server-${ver}-${plat}.tar.xz?job=tar-$(echo "${plat/alpine3.12/alpine}" | awk -F '-' '{ print ($3 == "darwin" || $2 == "unknown") ? $1 "-" $3 : $1 "-" $3 "-" $2 }')" - curl -f -o "haskell-language-server-${ver}-${plat}.tar.xz" "${url}" - done - unset plat url - - # windows - curl -f -o "haskell-language-server-${ver}-x86_64-unknown-mingw32.zip" \ - "${base_url}/out/haskell-language-server-${ver}-x86_64-unknown-mingw32.zip?job=tar-x86_64-windows" - - pwd - ls -lah - - # from https://github.com/actions/upload-release-asset/issues/47#issuecomment-659071145 - - name: Upload binaries tarball to the release - if: ${{ github.event.release.upload_url != '' }} - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - console.log('environment', process.versions); - - const fs = require('fs').promises; - - const { repo: { owner, repo }, sha } = context; - console.log({ owner, repo, sha }); - - for (let file of await fs.readdir('.')) { - console.log('uploading', file); - - await github.repos.uploadReleaseAsset({ - owner, repo, - release_id: ${{ github.event.release.id }}, - name: file, - data: await fs.readFile(`./${file}`) - }); - } - - - name: Upload binaries tarball to workflow artifacts - uses: actions/upload-artifact@v3 - with: - path: ${{ github.workspace }}/* - - sha256sum: - needs: [tar, src-tar] - runs-on: ubuntu-18.04 - steps: - - uses: actions/download-artifact@v3 - - - name: Generate sha256 sums for all workflow artifacts - run: | - sha256sum --tag haskell-language-server*/* >> SHA256SUMS - # we clean up tags to match the release file names - sed -i 's/\/.*)/)/g' SHA256SUMS - - - name: Upload sha256sums to the release - if: ${{ github.event.release.upload_url != '' }} - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: SHA256SUMS - asset_name: SHA256SUMS - asset_content_type: plain/text - - - name: Upload sha256sums to workflow artifacts - uses: actions/upload-artifact@v3 - with: - name: SHA256SUMS - path: SHA256SUMS diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml deleted file mode 100644 index 74e94ca907f..00000000000 --- a/.github/workflows/caching.yml +++ /dev/null @@ -1,134 +0,0 @@ -name: Caching - -# Docs on the workflow: -# 1. GitHub cache scoping goes: -# [main branch -> PR main branch -> PR. (essentially in a tree fashion)](https://web.archive.org/web/20211125171853/https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache). -# Building & keeping caches on `master` allows -# to share the main project state cache be shared to the whole tree. -# 2. GitHub has a [default 10G cache pool limit](https://web.archive.org/web/20211125171853/https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy) per repo. -# HLS is a big monorepo codebase, which means easy cache pool -# invalidation & exhaustion because of the pool limit. -# To keep caches useful - the main state of the main branch should remain -# & so keep caching in the repo well below the limit. -# that means preferring main branch to the PR caches -# (especially internal branch ones), since PRs from internal branches - -# count into the repo 10G pool, while that cache gets used only inside of the PR, -# while exhausting the pool would bork cache for the rest of the community. -# That is a short story why `dist-newstyle` (especially full) currently is not -# includded into `master` or PR caches. - -defaults: - run: - shell: bash - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - workflow_dispatch: - push: - branches: - - master - schedule: - # Refresh snapshot every (02+8*x):25 UTC - # When cache is present it is a light check workflow with early termination. - # When primary cache is not hit - runs the cache generation. - # Why: GitHub repo has 10G pool & on overflow GitHub removes caches in FIFO manner. - # When internal branche PRs save into the same pool - - # their cache is accessible only inside of the scope of the PR. - # If main cache is forced out - there are no cache shared between PRs, - # which implies all PRs would start to create & save their cache. - # Reinstitution of the main chache puts it back into FIFO - # & so it gets shared across all PRs. - - cron: "25 2/8 * * *" - -# Not using a explicit target to build the top level haskell-language-server package -# which make build the rest of subpackages *libs* (but shake-bench) -env: - cabalBuild: "v2-build --keep-going" - -jobs: - - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths_ignore: '["**/docs/**" - , "**.md" - , "**/LICENSE" - , "**.nix" - , "flake.lock" - , "**/README.md" - , "FUNDING.yml" - , ".circleci/**" - , "**/stack*.yaml" - , ".gitlab-ci.yaml" - , ".gitlab/**" - ]' - - caching: - if: needs.pre_job.outputs.should_skip != 'true' - needs: pre_job - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - # This list of GHC versions must fit to the list of GHC versions - # specified in 'test.yml' - ghc: [ "9.4.3" - , "9.4.2" - , "9.2.5" - , "9.2.4" - , "9.0.2" - , "8.10.7" - ] - os: [ "ubuntu-latest" - , "macOS-latest" - , "windows-latest" - ] - exclude: - - os: windows-latest - ghc: '9.4.1' - # Exclude until https://github.com/haskell/actions/issues/129 - # is resolved. - - os: windows-latest - ghc: '9.2.5' - - steps: - - uses: actions/checkout@v3 - - - uses: ./.github/actions/setup-build - with: - ghc: ${{ matrix.ghc }} - os: ${{ runner.os }} - - # Download sources for feeding build sources cache - # Fetching from github cache is faster than doing it from hackage - # Sources does not change per ghc and ghc version son only doing it - # for one matrix job (it is arbitrary) - - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7' - name: Download sources - run: | - cabal $cabalBuild --only-download --enable-benchmarks --enable-tests - - # This build agenda is not to have successful code but produce cache as much as possible - - if: steps.compiled-deps.outputs.cache-hit != 'true' - name: Build haskell-language-server - run: | - # repeating builds to workaround segfaults in windows and ghc-8.8.4 - cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild - - # We build ghcide with benchs and test enabled to include its dependencies in the cache - # (including shake-bench) - # Only for the same ghc and os used in the bench workflow, so we save cache space - - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7' - name: Build ghcide benchmark - run: | - cabal $cabalBuild ghcide --enable-benchmarks --enable-tests diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml deleted file mode 100644 index 775c4037fff..00000000000 --- a/.github/workflows/flags.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Flags - -defaults: - run: - shell: bash - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - pull_request: - branches: - - '**' - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths_ignore: '[ "**/docs/**" - , "**.md" - , "**/LICENSE" - , "**.nix" - , "flake.lock" - , "**/README.md" - , "FUNDING.yml" - , ".circleci/**" - , "**/stack*.yaml" - , ".gitlab-ci.yaml" - , ".gitlab/**" - ]' - - flags: - if: needs.pre_job.outputs.should_skip != 'true' - needs: pre_job - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - ghc: [ "9.2.5" - , "9.0.2" - , "8.10.7" - ] - os: [ "ubuntu-latest" - ] - - steps: - - uses: actions/checkout@v3 - - - uses: ./.github/actions/setup-build - with: - ghc: ${{ matrix.ghc }} - os: ${{ runner.os }} - - - name: Build `hls-graph` with flags - run: cabal v2-build hls-graph --flags="embed-files stm-stats" - - - name: Build `ghcide` with flags - run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe ekg" - - # we have to clean up warnings for 9.0 and 9.2 before enable -Wall - - if: matrix.ghc != '9.0.2' && matrix.ghc != '9.2.5' - name: Build with pedantic (-WError) - run: cabal v2-build --flags="pedantic" - - flags_post_job: - if: always() - runs-on: ubuntu-latest - needs: [pre_job, flags] - steps: - - run: | - echo "jobs info: ${{ toJSON(needs) }}" - - if: contains(needs.*.result, 'failure') - run: exit 1 - - if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true' - run: exit 1 diff --git a/.github/workflows/hackage.yml b/.github/workflows/hackage.yml deleted file mode 100644 index 34e6b8b62b7..00000000000 --- a/.github/workflows/hackage.yml +++ /dev/null @@ -1,166 +0,0 @@ -name: Hackage - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - workflow_dispatch: - inputs: - upload: - description: 'Whether packages should be uploaded' - required: true - default: 'false' - publish: - description: 'Wheter packages should be published as definitive' - required: true - default: 'false' - push: - branches: - - '*-hackage' - -jobs: - check-and-upload-tarballs: - runs-on: ubuntu-latest - strategy: - fail-fast: ${{ github.event.inputs.upload != 'false' }} - matrix: - package: ["hie-compat", "hls-graph", "shake-bench", - "hls-plugin-api", "ghcide", "hls-test-utils", - "hls-cabal-plugin", - "hls-brittany-plugin", "hls-floskell-plugin", "hls-fourmolu-plugin", - "hls-ormolu-plugin", "hls-stylish-haskell-plugin", - "hls-class-plugin", "hls-eval-plugin", "hls-explicit-imports-plugin", - "hls-haddock-comments-plugin", "hls-hlint-plugin", "hls-stan-plugin", - "hls-module-name-plugin", "hls-pragmas-plugin", - "hls-refine-imports-plugin", "hls-rename-plugin", "hls-retrie-plugin", - "hls-splice-plugin", "hls-tactics-plugin", - "hls-call-hierarchy-plugin", "hls-alternate-number-format-plugin", - "hls-qualify-imported-names-plugin", "hls-code-range-plugin", - "hls-cabal-fmt-plugin", - "haskell-language-server"] - ghc: [ "9.0.2" - , "8.10.7" - ] - exclude: - - ghc: "9.0.2" - package: "hls-stylish-haskell-plugin" - - steps: - - - uses: actions/checkout@v3 - - - uses: ./.github/actions/setup-build - with: - ghc: ${{ matrix.ghc }} - os: ${{ runner.os }} - shorten-hls: 'false' - - - name: "Run cabal check" - run: | - if [[ ${{ matrix.package }} == *plugin ]]; then - cd plugins - fi - if [[ ${{ matrix.package }} != haskell-language-server ]]; then - cd ${{ matrix.package }} - fi - cabal check - - - name: "Generate package dist tarball" - id: generate-dist-tarball - run: | - if [[ ${{ matrix.package }} == haskell-language-server ]]; then - cabal sdist --builddir=./ - else - cabal sdist ${{ matrix.package }} --builddir=./ - fi - echo ::set-output name=path::$(ls ./sdist/${{ matrix.package }}-*) - - - name: "Unpack package source in an isolated location" - run: cabal unpack ${{ steps.generate-dist-tarball.outputs.path }} --destdir=./incoming - - - name: "Try to get the current hackage version" - id: get-hackage-version - run: | - cd ./incoming - if cabal get $(ls -d ${{ matrix.package }}-*) --destdir=../current; then - echo ::set-output name=exists::true - else - echo ::set-output name=exists::false - fi - - - name: "Compare the incoming and the current hackage version of the package" - id: compare-current-version - if: steps.get-hackage-version.outputs.exists == 'true' - run: | - # This will throw an error if there is any difference cause we have to bump up the package version - diff -r -x "*.md" -x "data" $(ls -d ./incoming/${{ matrix.package }}-*) $(ls -d ./current/${{ matrix.package }}-*) - - - name: "Create appropiate cabal.project" - if: steps.get-hackage-version.outputs.exists != 'true' - run: | - cd $(ls -d ./incoming/${{ matrix.package }}-*) - echo "packages: . ../../* ../../plugins/*" > cabal.project - - # These tweaks are already in cabal-901.project but we dont want to use the entire file, - # Only the tricks needed by the solver which we know will not make the hackage build fail. - # The solver takes in account all project packages, even if they are not gonna be effectively built - # (like brittany or stylish-haskell for ghc-9.0) - - name: "Add temporary needed allow-newer for ghc-9.0" - if: steps.get-hackage-version.outputs.exists != 'true' && matrix.ghc == '9.0.2' - run: | - cd $(ls -d ./incoming/${{ matrix.package }}-*) - # For brittany - echo "allow-newer:" >> cabal.project - echo " butcher:base, multistate:base, data-tree-print:base," >> cabal.project - # For stylish-haskell - echo " stylish-haskell:Cabal,stylish-haskell:ghc-lib-parser,stylish-haskell:aeson" >> cabal.project - - - name: "Build main package components in isolation" - if: steps.get-hackage-version.outputs.exists != 'true' - run: | - cd $(ls -d ./incoming/${{ matrix.package }}-*) - cabal build - - - name: "Build package tests and benchmarks in isolation" - if: steps.get-hackage-version.outputs.exists != 'true' - run: | - cd $(ls -d ./incoming/${{ matrix.package }}-*) - cabal build --enable-tests --enable-benchmarks - - - name: "Generate haddock for hackage" - if: steps.get-hackage-version.outputs.exists != 'true' - run: | - cd $(ls -d ./incoming/${{ matrix.package }}-*) - cabal haddock --haddock-for-hackage - - - name: "Upload package dist tarball" - if: steps.get-hackage-version.outputs.exists != 'true' && matrix.ghc == '8.10.7' - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.package }} - path: ${{ steps.generate-dist-tarball.outputs.path }} - - upload-package: - # Runs triggered by *-hackage branches will upload packages - # cause inputs are blank when the workflow is not triggered manually - if: github.event.inputs.upload != 'false' - needs: check-and-upload-tarballs - runs-on: ubuntu-latest - steps: - - - uses: actions/download-artifact@v3 - with: - path: packages - - - name: "Join all tarballs" - run: find ./packages -type f -name '*.tar.gz' -exec cp {} ./packages \; - - - name: "Upload all tarballs to hackage" - uses: haskell-actions/hackage-publish@v1 - with: - hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }} - packagesPath: packages - # runs triggered by *-hackage branches will not publish packages definitely - publish: ${{ github.event.inputs.publish == 'true' }} diff --git a/.github/workflows/hlint.yml b/.github/workflows/hlint.yml deleted file mode 100644 index 62d87420392..00000000000 --- a/.github/workflows/hlint.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "HLint check" - -on: - pull_request: - branches: - - '**' - -jobs: - hlint: - name: "Hlint check run" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: 'Installing' - uses: rwe/actions-hlint-setup@v1 - with: - version: '3.5' - - - name: 'Checking code' - uses: rwe/actions-hlint-run@v2 - with: - hlint-bin: "hlint --with-group=extra" - fail-on: error - path: . - diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml deleted file mode 100644 index fc9f3003152..00000000000 --- a/.github/workflows/nix.yml +++ /dev/null @@ -1,130 +0,0 @@ -name: Nix - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - pull_request: - branches: - - '**' - push: - branches: - - master - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip_develop: ${{ steps.skip_check.outputs.should_skip }} - should_skip_build: ${{ steps.skip_check_no_nix.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths_ignore: '[ "**/docs/**" - , "**.md" - , "**/LICENSE" - , ".circleci/**" - , "**/README.md" - , "FUNDING.yml" - , "**/stack*.yaml" - , "**/stack*.yaml" - , ".gitlab-ci.yaml" - , ".gitlab/**" - ]' - - id: skip_check_no_nix - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths: '[ "**.nix" ]' - - # Enter the development shell and run `cabal build` - develop: - if: needs.pre_job.outputs.should_skip_develop != 'true' - needs: pre_job - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macOS-latest] - - steps: - - uses: actions/checkout@v3 - - - uses: cachix/install-nix-action@v18 - with: - extra_nix_config: | - experimental-features = nix-command flakes - nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v12 - with: - name: haskell-language-server - # Disable pushing, we will do that in job `build` - skipPush: true - - run: | - nix develop --print-build-logs --command cabal update - nix develop --print-build-logs --command cabal build - - # Build and then push HLS binaries with developmet shell to cachix - # This job runs when - # 1. PRs are merged to master (runs on master) - # 2. Nix files are changed (runs on PR) - build: - needs: pre_job - runs-on: ${{ matrix.os }} - env: - HAS_TOKEN: ${{ secrets.HLS_CACHIX_AUTH_TOKEN != '' }} - if: (needs.pre_job.outputs.should_skip_build != 'true' && needs.pre_job.outputs.should_skip_pr != 'true') || (github.repository_owner == 'haskell' && github.ref == 'refs/heads/master') - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macOS-latest] - - steps: - - uses: actions/checkout@v3 - - - uses: cachix/install-nix-action@v18 - with: - install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install - install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve' - extra_nix_config: | - experimental-features = nix-command flakes - nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v12 - with: - name: haskell-language-server - authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }} - - name: Build development shell - run: nix develop --print-build-logs --profile dev - - name: Build all development shell (without nix dependencies) - run: nix develop --print-build-logs .#all-simple-dev-shells --profile dev - # We only build nix dev shell for current GHC version because some are - # failing with different GHC version on darwin. - - name: Build development shell with nix dependencies for current GHC version - run: nix develop --print-build-logs .#all-nix-dev-shells --profile dev - - name: Push development shell - if: ${{ env.HAS_TOKEN == 'true' }} - run: cachix push haskell-language-server dev - - name: Build binaries - run: nix build --print-build-logs - - name: Build all binaries - run: nix build --print-build-logs .#all-haskell-language-server - - name: Push binaries - if: ${{ env.HAS_TOKEN == 'true' }} - run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server - - nix_post_job: - if: always() - runs-on: ubuntu-latest - needs: [pre_job, develop, build] - steps: - - run: | - echo "jobs info: ${{ toJSON(needs) }}" - - if: contains(needs.*.result, 'failure') - run: exit 1 - - if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true' - run: exit 1 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index de2b6938c69..00000000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [master] - -jobs: - file-diff: - runs-on: ubuntu-latest - outputs: - git-diff: ${{ steps.git-diff.outputs.diff }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Find changed files - uses: technote-space/get-diff-action@v6.1.2 - id: git-diff - with: - PATTERNS: | - +(src|exe|test|ghcide|plugins|hls-plugin-api|hie-compat|hls-graph|hls-test-utils)/**/*.hs - pre-commit: - runs-on: ubuntu-latest - needs: file-diff - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-build - with: - # select a stable GHC version - ghc: 9.2.5 - os: ${{ runner.os }} - shorten-hls: false - - - name: "Install stylish-haskell" - run: | - cabal install stylish-haskell - echo "${HOME}/.cabal/bin" >> $GITHUB_PATH - - - name: "Check stylish-haskell is available" - run: | - echo $(which stylish-haskell) - - - name: Compiled deps cache - id: stylish-haskell-compiled-cache - uses: actions/cache@v3 - env: - cache-name: stylish-haskell-compiled-cache - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}- - ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}- - ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}- - - - uses: actions/setup-python@v4 - - uses: pre-commit/action@v3.0.0 - with: - extra_args: --files ${{ needs.file-diff.outputs.git-diff }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000000..42a3d1de844 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,301 @@ +name: Build and release + +on: + push: + branches: + - master + tags: + - 'v*' + pull_request: + branches: + - master + schedule: + - cron: '0 2 * * *' + +jobs: + build-linux: + name: Build linux binaries + runs-on: ubuntu-latest + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + TARBALL_EXT: tar.xz + ARCH: 64 + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + strategy: + fail-fast: false + matrix: + include: + - image: alpine:3.12 + installCmd: apk update && apk add --no-cache + toolRequirements: binutils-gold gcc g++ gmp-dev libc-dev libffi-dev make musl-dev ncurses-dev ncurses-static perl tar xz xz-dev automake autoconf coreutils bsd-compat-headers diffutils gzip findutils tree zlib-dev patchelf + ARTIFACT: "x86_64-linux-alpine" + DISTRO: Alpine + ADD_CABAL_ARGS: "--enable-split-sections" + - image: alpine:3.12 + installCmd: apk update && apk add --no-cache + toolRequirements: binutils-gold gcc g++ gmp-dev libc-dev libffi-dev make musl-dev ncurses-dev ncurses-static perl tar xz xz-dev automake autoconf coreutils bsd-compat-headers diffutils gzip findutils tree zlib-dev patchelf + ARTIFACT: "x86_64-linux-alpine-static" + DISTRO: Alpine + ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static -f-dynamic" + - image: debian:9 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb9" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: debian:10 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb10" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: debian:11 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Debian + ARTIFACT: "x86_64-linux-deb11" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: ubuntu:18.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu18.04" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: ubuntu:20.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu20.04" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: ubuntu:22.04 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Ubuntu + ARTIFACT: "x86_64-linux-ubuntu22.04" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: fedora:27 + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf + DISTRO: Fedora + ARTIFACT: "x86_64-linux-fedora27" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: fedora:33 + installCmd: dnf install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf + DISTRO: Fedora + ARTIFACT: "x86_64-linux-fedora33" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: centos:7 + installCmd: yum -y install epel-release && yum install -y + toolRequirements: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf + DISTRO: CentOS + ARTIFACT: "x86_64-linux-centos7" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: linuxmintd/mint19.3-amd64 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Mint + ARTIFACT: "x86_64-linux-mint19.3" + ADD_CABAL_ARGS: "--enable-split-sections" + - image: linuxmintd/mint20.2-amd64 + installCmd: apt-get update && apt-get install -y + toolRequirements: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf + DISTRO: Mint + ARTIFACT: "x86_64-linux-mint20.2" + ADD_CABAL_ARGS: "--enable-split-sections" + container: + image: ${{ matrix.image }} + steps: + - name: Install requirements + shell: sh + run: | + ${{ matrix.installCmd }} curl bash git ${{ matrix.toolRequirements }} + - uses: actions/checkout@v3 + - name: Run build + run: bash .github/scripts/build.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + DISTRO: ${{ matrix.DISTRO }} + ADD_CABAL_ARGS: ${{ matrix.ADD_CABAL_ARGS }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: | + ./out/* + + + build-arm: + name: Build ARM binary + runs-on: ${{ matrix.os }} + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + TARBALL_EXT: tar.xz + ADD_CABAL_ARGS: "" + DEBIAN_FRONTEND: noninteractive + TZ: Asia/Singapore + strategy: + fail-fast: true + matrix: + include: + - os: [self-hosted, Linux, ARM64] + ARTIFACT: "aarch64-linux-ubuntu20" + ARCH: ARM64 + steps: + - uses: docker://arm64v8/ubuntu:focal + name: Cleanup (aarch64 linux) + with: + args: rm -rf .ghcup/ cabal/ dist-newstyle/ out/ + + - name: git config + run: | + git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" + shell: bash + + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: 'true' + + - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal + name: Run build (aarch64 linux) + with: + args: bash .github/scripts/build.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + ARCH: ${{ matrix.ARCH }} + DISTRO: Ubuntu + AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ env.S3_HOST }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: | + ./out/* + + build-mac: + name: Build binary (Mac/Win) + runs-on: ${{ matrix.os }} + env: + MACOSX_DEPLOYMENT_TARGET: 10.13 + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + ADD_CABAL_ARGS: "" + strategy: + fail-fast: false + matrix: + include: + - os: [self-hosted, macOS, ARM64] + ARTIFACT: "aarch64-apple-darwin-ghcup" + ARCH: ARM64 + TARBALL_EXT: tar.xz + - os: macOS-10.15 + ARTIFACT: "x86_64-apple-darwin-ghcup" + ARCH: 64 + TARBALL_EXT: tar.xz + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: 'true' + + - name: Run build (windows/mac) + run: bash .github/scripts/build.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + ARCH: ${{ matrix.ARCH }} + DISTRO: na + AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ env.S3_HOST }} + HOMEBREW_CHANGE_ARCH_TO_ARM: 1 + TARBALL_EXT: ${{ matrix.TARBALL_EXT }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: | + ./out/* + + build-win: + name: Build binary (Win) + runs-on: ${{ matrix.os }} + defaults: + run: + shell: msys2 {0} + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ secrets.S3_HOST }} + ADD_CABAL_ARGS: "" + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + ARTIFACT: "x86_64-mingw64-ghcup" + ARCH: 64 + TARBALL_EXT: zip + steps: + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + install: make mingw-w64-x86_64-clang curl autoconf mingw-w64-x86_64-pkgconf ca-certificates base-devel gettext autoconf make libtool automake python p7zip patch unzip zip + + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: 'true' + + - name: Run build (windows/mac) + run: bash .github/scripts/build.sh + env: + ARTIFACT: ${{ matrix.ARTIFACT }} + ARCH: ${{ matrix.ARCH }} + DISTRO: na + AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + S3_HOST: ${{ env.S3_HOST }} + HOMEBREW_CHANGE_ARCH_TO_ARM: 1 + TARBALL_EXT: ${{ matrix.TARBALL_EXT }} + + - if: always() + name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: | + ./out/* + + release: + name: release + needs: ["build-linux", "build-mac", "build-win", "build-arm"] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: artifacts + path: ./out + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + ./out/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1bcd200b6c5..00000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,293 +0,0 @@ -name: Testing - -defaults: - run: - shell: bash - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - pull_request: - branches: - - '**' - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - should_skip_ghcide: ${{ steps.skip_ghcide_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths_ignore: '[ "**/docs/**" - , "**.md" - , "**/LICENSE" - , "**.nix" - , "flake.lock" - , "**/README.md" - , "FUNDING.yml" - , ".circleci/**" - , "**/stack*.yaml" - , ".gitlab-ci.yaml" - , ".gitlab/**" - ]' - # If we only change ghcide downstream packages we have not test ghcide itself - - id: skip_ghcide_check - uses: fkirc/skip-duplicate-actions@v5.3.0 - with: - cancel_others: false - paths_ignore: '[ "hls-test-utils/**" - , "plugins/**" - , "src/**" - , "exe/**" - , "test/**" - , "shake-bench/**" - ]' - - test: - if: needs.pre_job.outputs.should_skip != 'true' - needs: pre_job - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - # when you edit this list of GHC versions, - # **don't forget** - # to update the ghc versions in 'caching.yml'. - matrix: - ghc: [ "9.4.3" - , "9.4.2" - , "9.2.5" - , "9.2.4" - , "9.2.3" - , "9.0.2" - , "8.10.7" - ] - os: [ "ubuntu-latest" - , "macOS-latest" - , "windows-latest" - ] - # don't build these versions - # they are broken for good reasons, e.g. compiler is bugged - # on that platform. - exclude: - - os: windows-latest - ghc: '9.4.1' - # Exclude until https://github.com/haskell/actions/issues/129 - # is resolved. - - os: windows-latest - ghc: '9.4.3' # Excluded because github action cannot install it - - os: windows-latest - ghc: '9.2.5' - # Mark which GHC versions on which platform we want to test. - include: - # only test supported ghc major versions - - os: ubuntu-latest - ghc: '9.4.3' - test: true - - os: ubuntu-latest - ghc: '9.2.5' - test: true - - os: ubuntu-latest - ghc: '9.0.2' - test: true - - os: ubuntu-latest - ghc: '8.10.7' - test: true - - os: windows-latest - ghc: '9.4.2' - test: true - # Test on 9.2.4 until https://github.com/haskell/actions/issues/129 - # is resolved. Then switch to 9.2.5 - - os: windows-latest - ghc: '9.2.4' - test: true - - os: windows-latest - ghc: '9.0.2' - test: true - - os: windows-latest - ghc: '8.10.7' - test: true - - steps: - - uses: actions/checkout@v3 - - - uses: ./.github/actions/setup-build - with: - ghc: ${{ matrix.ghc }} - os: ${{ runner.os }} - - - name: Build - run: cabal build - - - name: Set test options - # run the tests without parallelism, otherwise tasty will attempt to run - # all functional test cases simultaneously which causes way too many hls - # instances to be spun up for the poor github actions runner to handle - run: | - echo "TEST_OPTS=-j1 --rerun-update --rerun-filter failures,exceptions" >> $GITHUB_ENV - - - name: Cache test log between attempts of the same run - uses: actions/cache@v3 - env: - cache-name: cache-test-log - with: - path: "**/.tasty-rerun-log*" - key: v1-${{ runner.os }}-${{ matrix.ghc }}-test-log-${{ github.sha }} - - - if: matrix.test - name: Test hls-graph - run: cabal test hls-graph --test-options="$TEST_OPTS" - - - if: needs.pre_job.outputs.should_skip_ghcide != 'true' && matrix.test - name: Test ghcide - # run the tests without parallelism to avoid running out of memory - run: cabal test ghcide --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test ghcide --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-plugin-api - run: cabal test hls-plugin-api --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-plugin-api --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test func-test suite - env: - HLS_TEST_EXE: hls - HLS_WRAPPER_TEST_EXE: hls-wrapper - run: cabal test func-test --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test func-test --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test wrapper-test suite - env: - HLS_TEST_EXE: hls - HLS_WRAPPER_TEST_EXE: hls-wrapper - run: cabal test wrapper-test --test-options="$TEST_OPTS --rerun-log-file .tasty-rerun-log-wrapper" - - - if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.2.5' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-brittany-plugin - run: cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-brittany-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-refactor-plugin - run: cabal test hls-refactor-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-refactor-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-floskell-plugin - run: cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-floskell-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-class-plugin - run: cabal test hls-class-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-class-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-pragmas-plugin - run: cabal test hls-pragmas-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-pragmas-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-eval-plugin - run: cabal test hls-eval-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-eval-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.2.5' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-haddock-comments-plugin - run: cabal test hls-haddock-comments-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-haddock-comments-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-splice-plugin - run: cabal test hls-splice-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-splice-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-stylish-haskell-plugin - run: cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-ormolu-plugin - run: cabal test hls-ormolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-ormolu-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-fourmolu-plugin - run: cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.2.4' && matrix.ghc != '9.2.5' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-tactics-plugin test suite - run: cabal test hls-tactics-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-refine-imports-plugin test suite - run: cabal test hls-refine-imports-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-refine-imports-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-explicit-imports-plugin test suite - run: cabal test hls-explicit-imports-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-explicit-imports-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-call-hierarchy-plugin test suite - run: cabal test hls-call-hierarchy-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-call-hierarchy-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.os != 'windows-latest' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-rename-plugin test suite - run: cabal test hls-rename-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-rename-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-hlint-plugin test suite - run: cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-hlint-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2' && matrix.ghc != '9.2.4' && matrix.ghc != '9.2.5' && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-stan-plugin test suite - run: cabal test hls-stan-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stan-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-module-name-plugin test suite - run: cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-module-name-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-alternate-number-format-plugin test suite - run: cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-qualify-imported-names-plugin test suite - run: cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-code-range-plugin test suite - run: cabal test hls-code-range-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-code-range-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-change-type-signature test suite - run: cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" - - - if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3' - name: Test hls-gadt-plugin test suit - run: cabal test hls-gadt-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-gadt-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-explicit-fixity-plugin test suite - run: cabal test hls-explicit-fixity-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-explicit-fixity-plugin --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-explicit-record-fields-plugin test suite - run: cabal test hls-explicit-record-fields-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-explicit-record-fields-plugin --test-options="$TEST_OPTS" - - ## version needs to be limited since the tests depend on cabal-fmt which only builds using specific ghc versions - - if: matrix.test && matrix.ghc == '8.10.7' - name: Test hls-cabal-fmt-plugin test suite - run: cabal test hls-cabal-fmt-plugin --flag=isolateTests --test-options="$TEST_OPTS" || cabal test hls-cabal-fmt-plugin --flag=isolateTests --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-cabal-fmt-plugin --flag=isolateTests --test-options="$TEST_OPTS" - - - if: matrix.test - name: Test hls-cabal-plugin test suite - run: cabal test hls-cabal-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-cabal-plugin --test-options="$TEST_OPTS" - - test_post_job: - if: always() - runs-on: ubuntu-latest - needs: [pre_job, test] - steps: - - run: | - echo "jobs info: ${{ toJSON(needs) }}" - - if: contains(needs.*.result, 'failure') - run: exit 1 - - if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true' - run: exit 1 diff --git a/GNUmakefile b/GNUmakefile index f26c9b4b20b..03a1225d647 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -40,7 +40,9 @@ RM_RF := $(RM) -rf CD := cd # by default don't run ghcup -GHCUP ?= echo +GHCUP ?= echo + +CABAL_CACHE_BIN ?= echo ifeq ($(UNAME), Darwin) DLL := *.dylib @@ -54,9 +56,13 @@ STORE_DIR := store BINDIST_BASE_DIR := out/bindist BINDIST_OUT_DIR := $(BINDIST_BASE_DIR)/haskell-language-server-$(HLS_VERSION) -CABAL_ARGS ?= --store-dir=$(ROOT_DIR)/$(STORE_DIR) -CABAL_INSTALL_ARGS ?= --disable-tests --disable-profiling -O2 --overwrite-policy=always --install-method=copy -CABAL_INSTALL := $(CABAL) $(CABAL_ARGS) v2-install +CABAL_BASE_ARGS ?= --store-dir=$(ROOT_DIR)/$(STORE_DIR) +CABAL_ARGS ?= --disable-tests --disable-profiling -O2 +CABAL_INSTALL_ARGS ?= --overwrite-policy=always --install-method=copy +CABAL_INSTALL := $(CABAL) $(CABAL_BASE_ARGS) v2-install + +S3_HOST ?= +S3_KEY ?= # set rpath relative to the current executable # TODO: on darwin, this doesn't overwrite rpath, but just adds to it, @@ -66,27 +72,33 @@ define set_rpath endef hls: bindist/ghcs - for ghc in $(shell [ -e "bindist/ghcs-`uname -o`" ] && cat "bindist/ghcs-`uname -o`" || cat "bindist/ghcs") ; do \ - $(GHCUP) -v install ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` && \ - $(GHCUP) -v gc -p -s -c && \ - $(MAKE) GHC_VERSION=`echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` PROJECT_FILE=`echo $$ghc | $(AWK) -F ',' '{ print $$2 }'` hls-ghc && \ - $(GHCUP) -v rm ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` ; \ + for ghc in $(shell [ -e "bindist/ghcs-`uname -o`-`uname -p`" ] && cat "bindist/ghcs-`uname -o`-`uname -p`" || shell [ -e "bindist/ghcs-`uname -o`" ] && cat "bindist/ghcs-`uname -o`" || cat "bindist/ghcs") ; do \ + $(GHCUP) install ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` && \ + $(GHCUP) gc -p -s -c -t && \ + $(MAKE) GHC_VERSION=`echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` PROJECT_FILE=`echo $$ghc | $(AWK) -F ',' '{ print $$2 }'` hls-ghc || exit 1 ; \ + $(GHCUP) rm ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` ; \ done hls-ghc: $(MKDIR_P) out/ @if test -z "$(GHC_VERSION)" ; then echo >&2 "GHC_VERSION is not set" ; false ; fi @if test -z "$(PROJECT_FILE)" ; then echo >&2 "PROJECT_FILE is not set" ; false ; fi - $(CABAL_INSTALL) --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_INSTALL_ARGS) --installdir="$(ROOT_DIR)/out/$(GHC_VERSION)" exe:haskell-language-server exe:haskell-language-server-wrapper + $(CABAL) $(CABAL_BASE_ARGS) configure --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) exe:haskell-language-server exe:haskell-language-server-wrapper + $(CABAL) $(CABAL_BASE_ARGS) build --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) --dependencies-only --dry-run exe:haskell-language-server exe:haskell-language-server-wrapper + $(CABAL_CACHE_BIN) sync-from-archive --host-name-override=$(S3_HOST) --host-port-override=443 --host-ssl-override=True --region us-west-2 --store-path="$(ROOT_DIR)/$(STORE_DIR)" --archive-uri "s3://haskell-language-server/$(S3_KEY)" + $(CABAL) $(CABAL_BASE_ARGS) build --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) --dependencies-only exe:haskell-language-server exe:haskell-language-server-wrapper + $(CABAL_CACHE_BIN) sync-to-archive --host-name-override=$(S3_HOST) --host-port-override=443 --host-ssl-override=True --region us-west-2 --store-path="$(ROOT_DIR)/$(STORE_DIR)" --archive-uri "s3://haskell-language-server/$(S3_KEY)" + $(CABAL_INSTALL) --project-file="$(PROJECT_FILE)" -w "ghc-$(GHC_VERSION)" $(CABAL_ARGS) $(CABAL_INSTALL_ARGS) --installdir="$(ROOT_DIR)/out/$(GHC_VERSION)" exe:haskell-language-server exe:haskell-language-server-wrapper + $(CABAL_CACHE_BIN) sync-to-archive --host-name-override=$(S3_HOST) --host-port-override=443 --host-ssl-override=True --region us-west-2 --store-path="$(ROOT_DIR)/$(STORE_DIR)" --archive-uri "s3://haskell-language-server/$(S3_KEY)" $(STRIP_S) "$(ROOT_DIR)/out/$(GHC_VERSION)/haskell-language-server" $(STRIP_S) "$(ROOT_DIR)/out/$(GHC_VERSION)/haskell-language-server-wrapper" bindist: for ghc in $(shell [ -e "bindist/ghcs-`uname`" ] && cat "bindist/ghcs-`uname`" || cat "bindist/ghcs") ; do \ - $(GHCUP) -v install ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` && \ - $(GHCUP) -v gc -p -s -c && \ - $(MAKE) GHC_VERSION=`echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` bindist-ghc && \ - $(GHCUP) -v rm ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` ; \ + $(GHCUP) install ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` && \ + $(GHCUP) gc -p -s -c -t && \ + $(MAKE) GHC_VERSION=`echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` bindist-ghc || exit 1 ; \ + $(GHCUP) rm ghc `echo $$ghc | $(AWK) -F ',' '{ print $$1 }'` ; \ done $(SED) -e "s/@@HLS_VERSION@@/$(HLS_VERSION)/" \ bindist/GNUmakefile.in > "$(BINDIST_OUT_DIR)/GNUmakefile" diff --git a/bindist/ghcs b/bindist/ghcs index 17e3ffea1c1..b6785e9c4b5 100644 --- a/bindist/ghcs +++ b/bindist/ghcs @@ -1,6 +1,5 @@ 8.10.7,cabal.project 9.0.2,cabal.project -9.2.3,cabal.project -9.2.4,cabal.project -9.4.1,cabal.project +9.2.5,cabal.project 9.4.2,cabal.project +9.4.3,cabal.project diff --git a/bindist/ghcs-Msys b/bindist/ghcs-Msys index 17e3ffea1c1..22498d144f0 100644 --- a/bindist/ghcs-Msys +++ b/bindist/ghcs-Msys @@ -1,6 +1,6 @@ 8.10.7,cabal.project 9.0.2,cabal.project -9.2.3,cabal.project 9.2.4,cabal.project -9.4.1,cabal.project +9.2.5,cabal.project 9.4.2,cabal.project +9.4.3,cabal.project