From e499382124e9d80d922a556a9c6990d7a24f404b Mon Sep 17 00:00:00 2001 From: Gautham Ganapathy Date: Thu, 12 Oct 2023 16:54:28 +0100 Subject: [PATCH] Github actions from https://github.com/freckle/stack-action --- .github/workflows/test.yml | 122 +++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c648a9c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,122 @@ +name: Test + +on: + pull_request: + push: + branches: main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + working-directory: testing + +jobs: + test: + strategy: + matrix: + runner: + - ubuntu-latest + - macOS-latest + - windows-latest + + resolver: + - nightly + - lts-21.14 # ghc-9.4.7 + + fail-fast: false + + runs-on: ${{ matrix.runner }} + + steps: + - uses: actions/checkout@v3 + - id: stack + uses: ./ + with: + working-directory: example + stack-arguments: --resolver ${{ matrix.resolver }} + cache-prefix: ${{ matrix.resolver }}/ + + - if: ${{ runner.os != 'windows' }} + run: | + [[ "${{ steps.stack.outputs.compiler }}" = "ghc-8.10.4" ]] + [[ "${{ steps.stack.outputs.compiler-version }}" = "8.10.4" ]] + + # 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@v3 + - id: generate + uses: ./generate-matrix + with: + working-directory: testing + 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@v3 + - uses: ./ + with: + working-directory: testing + stack-yaml: ${{ matrix.stack-yaml }} + + test-auto-nightly: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - id: stack + uses: ./ + with: + working-directory: testing + stack-yaml: stack-nightly.yaml + cache-prefix: auto-nightly/ + + test-auto-nightly-with-explicit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - id: stack + uses: ./ + with: + working-directory: testing + stack-yaml: stack-nightly.yaml + stack-arguments: --resolver nightly + cache-prefix: auto-nightly-explicit/ \ No newline at end of file