Skip to content

Use stack-path instead of inferring --programs #315

Use stack-path instead of inferring --programs

Use stack-path instead of inferring --programs #315

Workflow file for this run

name: Example
on:
pull_request:
push:
branches: main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: example
jobs:
test:
strategy:
matrix:
runner:
- ubuntu-latest
- macOS-latest
- windows-latest
stack:
- resolver: nightly
- resolver: lts
- resolver: lts-22.7
ghc: "9.6.4"
- resolver: lts-12.26
ghc: "8.4.4"
exclude:
# Binary distributions for older GHCs don't exist on macOS-latest
- runner: macOS-latest
stack: {ghc: "8.4.4"}
fail-fast: false
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- id: stack
uses: ./
with:
working-directory: example
stack-arguments: --resolver ${{ matrix.stack.resolver }}
- name: Check compiler[-*] outputs
if: matrix.stack.ghc
shell: bash
run: |
[[ "${{ steps.stack.outputs.compiler }}" = ghc-${{ matrix.stack.ghc }} ]]
[[ "${{ steps.stack.outputs.compiler-version }}" = ${{ matrix.stack.ghc }} ]]
- name: Check presence of other outputs
shell: bash
run: |
# stack path | cut -d: -f1
[[ -n "${{ steps.stack.outputs.snapshot-doc-root }}" ]]
[[ -n "${{ steps.stack.outputs.local-doc-root }}" ]]
[[ -n "${{ steps.stack.outputs.local-hoogle-root }}" ]]
[[ -n "${{ steps.stack.outputs.stack-root }}" ]]
[[ -n "${{ steps.stack.outputs.project-root }}" ]]
[[ -n "${{ steps.stack.outputs.config-location }}" ]]
[[ -n "${{ steps.stack.outputs.bin-path }}" ]]
[[ -n "${{ steps.stack.outputs.programs }}" ]]
[[ -n "${{ steps.stack.outputs.compiler-exe }}" ]]
[[ -n "${{ steps.stack.outputs.compiler-bin }}" ]]
[[ -n "${{ steps.stack.outputs.compiler-tools-bin }}" ]]
[[ -n "${{ steps.stack.outputs.local-bin }}" ]]
# Actually blank in default setup
# [[ -n "${{ steps.stack.outputs.extra-include-dirs }}" ]]
# [[ -n "${{ steps.stack.outputs.extra-library-dirs }}" ]]
[[ -n "${{ steps.stack.outputs.snapshot-pkg-db }}" ]]
[[ -n "${{ steps.stack.outputs.local-pkg-db }}" ]]
[[ -n "${{ steps.stack.outputs.global-pkg-db }}" ]]
[[ -n "${{ steps.stack.outputs.ghc-package-path }}" ]]
[[ -n "${{ steps.stack.outputs.snapshot-install-root }}" ]]
[[ -n "${{ steps.stack.outputs.local-install-root }}" ]]
[[ -n "${{ steps.stack.outputs.dist-dir }}" ]]
[[ -n "${{ steps.stack.outputs.local-hpc-root }}" ]]
test-generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: generate
uses: ./generate-matrix
with:
working-directory: example
outputs:
stack-yamls: ${{ steps.generate.outputs.stack-yamls }}
test-stack-yamls:
needs: test-generate
runs-on: ubuntu-latest
strategy:
matrix:
stack-yaml: ${{ fromJSON(needs.test-generate.outputs.stack-yamls) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./
with:
working-directory: example
stack-arguments: --stack-yaml ${{ matrix.stack-yaml }}
test-fails-on-error:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Should fail
id: stack-action-step
continue-on-error: true
uses: ./
with:
working-directory: example
stack-arguments: --resolver bad-resolver
- name: Check failure
if: steps.stack-action-step.outcome != 'failure'
run: exit 1