Skip to content

Support GHC 9.4

Support GHC 9.4 #646

Workflow file for this run

env:
cache_generation: 2021-06-22
# NOTE: Please keep .mergify.yml in sync when adding or removing any jobs.
name: main
on: [pull_request]
jobs:
build:
strategy:
matrix:
os:
- runner: 'macOS-latest'
archive-command: 'tar --create --bzip2 --file'
file-extension: 'tar.bz2'
executable-extension: ''
- runner: 'ubuntu-latest'
archive-command: 'tar --create --bzip2 --file'
file-extension: 'tar.bz2'
executable-extension: ''
- runner: 'windows-latest'
archive-command: '7z a -tzip'
file-extension: 'zip'
executable-extension: '.exe'
fail-fast: false
name: ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
with:
submodules: true
- id: setup-haskell-cabal
name: "Setup Haskell environment"
uses: haskell/actions/setup@v2.4.6
with:
enable-stack: true
- name: "Cache"
uses: actions/cache@v2
with:
key: ${{ matrix.os.runner }}-${{ hashFiles('stack.yaml') }}-${{ env.cache_generation }}
restore-keys: |
${{ matrix.os.runner }}-
path: |
${{ steps.setup-haskell-cabal.outputs.stack-root }}
- name: Install libsodium
shell: bash
run: |
if [ '${{matrix.os.runner}}' == 'ubuntu-latest' ]; then
sudo apt-get install -y libsodium-dev
fi
- name: "Build"
shell: bash
run: |
packages=(
dhall
dhall-bash
dhall-csv
dhall-docs
dhall-json
dhall-lsp-server
dhall-nix
dhall-openapi
dhall-toml
dhall-yaml
)
for package in "${packages[@]}"; do
if [ '${{matrix.os.runner}}' == 'windows-latest' ] && [ "${package}" == 'dhall-nix' ]; then
continue
fi
# We use --test --no-run-tests to avoid re-building all the local packages in the
# subsequent test step.
# See https://github.com/commercialhaskell/stack/issues/4977.
stack build --test --no-run-tests --copy-bins --local-bin-path ./bin "${package}"
done
- name: "Run tests"
shell: bash
run: |
packages=(
dhall
dhall-bash
dhall-csv
dhall-docs
dhall-json
dhall-lsp-server
dhall-nix
dhall-openapi
dhall-toml
dhall-yaml
)
for package in "${packages[@]}"; do
if [ '${{matrix.os.runner}}' == 'windows-latest' ] && [ "${package}" == 'dhall-nix' ]; then
continue
fi
stack test "${package}"
done
- name: "Prepare packaging"
shell: bash
run: |
mkdir -p share/man/man1
cp dhall/man/dhall.1 share/man/man1/
cp dhall-docs/src/Dhall/data/man/dhall-docs.1 share/man/man1/
- id: package
name: "Create packages"
shell: bash
run: |
packages=(
dhall
dhall-bash
dhall-csv
dhall-docs
dhall-json
dhall-lsp-server
dhall-nix
dhall-openapi
dhall-toml
dhall-yaml
)
architecture="$(uname -m)"
function package() (
local package="${1}"
local version="$(stack query locals "${package}" version)"
shift
local assets=("${@}")
local package_file="${package}-${version}-${architecture}-${{runner.os}}.${{ matrix.os.file-extension }}"
${{matrix.os.archive-command}} "${package_file}" "${assets[@]}"
)
exe='${{matrix.os.executable-extension}}'
package 'dhall' "bin/dhall${exe}" 'share/man/man1/dhall.1'
package 'dhall-bash' "bin/dhall-to-bash${exe}"
package 'dhall-csv' "bin/csv-to-dhall${exe}" "bin/dhall-to-csv${exe}"
package 'dhall-docs' "bin/dhall-docs${exe}" 'share/man/man1/dhall-docs.1'
package 'dhall-json' "bin/dhall-to-json${exe}" "bin/dhall-to-yaml${exe}" "bin/json-to-dhall${exe}"
package 'dhall-lsp-server' "bin/dhall-lsp-server${exe}"
if [ '${{matrix.os.runner}}' != 'windows-latest' ]; then
package 'dhall-nix' "bin/dhall-to-nix${exe}"
fi
package 'dhall-openapi' "bin/openapi-to-dhall${exe}"
package 'dhall-toml' "bin/dhall-to-toml${exe}" "bin/toml-to-dhall${exe}"
package 'dhall-yaml' "bin/dhall-to-yaml-ng${exe}" "bin/yaml-to-dhall${exe}"
- name: "Upload package"
uses: actions/upload-artifact@v2
with:
name: 'dhall-${{runner.os}}.${{matrix.os.file-extension}}'
path: 'dhall-*${{runner.os}}.${{matrix.os.file-extension}}'