Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Use Cabal instead of Stack #2525

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env:
cache_generation: 2021-06-22
cache_generation: 2023-06-12
ghc_version: 8.10.7

# NOTE: Please keep .mergify.yml in sync when adding or removing any jobs.
name: main
Expand All @@ -26,22 +27,23 @@ jobs:
runs-on: ${{ matrix.os.runner }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- id: setup-haskell-cabal
name: "Setup Haskell environment"
uses: haskell/actions/setup@v1.2.1
uses: haskell/actions/setup@v2
with:
enable-stack: true
ghc-version: ${{ env.ghc_version }}
cabal-version: '3.10.1.0'
- name: "Cache"
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: ${{ matrix.os.runner }}-${{ hashFiles('stack.yaml') }}-${{ env.cache_generation }}
key: ${{ matrix.os.runner }}-${{ env.ghc_version }}-${{ hashFiles('**/cabal.project', '**/cabal.project.freeze', '**/*.cabal') }}-${{ env.cache_generation }}
restore-keys: |
${{ matrix.os.runner }}-
${{ matrix.os.runner }}-${{ env.ghc_version }}-
path: |
${{ steps.setup-haskell-cabal.outputs.stack-root }}
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
- name: Install libsodium
shell: bash
run: |
Expand All @@ -68,10 +70,7 @@ jobs:
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}"
cabal install --install-method=copy --installdir=./bin "${package}"
done
- name: "Run tests"
shell: bash
Expand All @@ -93,7 +92,7 @@ jobs:
continue
fi

stack test "${package}"
cabal test "${package}"
done
- name: "Prepare packaging"
shell: bash
Expand Down Expand Up @@ -122,7 +121,7 @@ jobs:

function package() (
local package="${1}"
local version="$(stack query locals "${package}" version)"
local version="$(jq -r ".\"install-plan\"[] | select(.\"pkg-name\" == \"${package}\") | .\"pkg-version\"" < dist-newstyle/cache/plan.json | head -n 1)"
shift
local assets=("${@}")
local package_file="${package}-${version}-${architecture}-${{runner.os}}.${{ matrix.os.file-extension }}"
Expand All @@ -143,7 +142,7 @@ jobs:
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
uses: actions/upload-artifact@v3
with:
name: 'dhall-${{runner.os}}.${{matrix.os.file-extension}}'
path: 'dhall-*${{runner.os}}.${{matrix.os.file-extension}}'
Loading