Webassembly day04 #647
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# | |
# .github/workflows/haskell.yml | |
# | |
name: Haskell Workflow | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
stage1: | |
name: Change Check | |
runs-on: 'ubuntu-latest' | |
outputs: | |
docs_changed: ${{ steps.check_file_changed.outputs.docs_changed }} | |
steps: | |
- name: Checkout Repo | |
id: checkout-repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
submodules: recursive | |
- name: Get Change List | |
id: check_file_changed | |
run: | | |
# Diff HEAD with the previous commit then output to stdout. | |
printf "=== Which files changed? ===\n" | |
GIT_DIFF="$(git diff --name-only HEAD^ HEAD)" | |
printf "%s\n" "${GIT_DIFF}" | |
printf "\n" | |
# Check if the files are present in the changed file list (added, modified, deleted) then output to stdout. | |
HAS_DIFF=false | |
printf "=== Which Haskell files changed? ===\n" | |
if printf "%s\n" "${GIT_DIFF}" | grep -E '^(haskell/.*[.](hs|cabal)|haskell/.*/stack[.]yaml[.].*|.github/workflows/haskell.yml)$'; then | |
HAS_DIFF=true | |
fi | |
printf "\n" | |
# Did Golang files change? | |
printf "=== Did Golang files change? ===\n" | |
printf "%s\n" "${HAS_DIFF}" | |
printf "\n" | |
# Set the output named "docs_changed" | |
printf "%s=%s\n" "docs_changed" "${HAS_DIFF}" >> "${GITHUB_OUTPUT}" | |
stage2: | |
name: Haskell Checks | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
exclude: | |
- os: "macos-latest" | |
- os: "windows-latest" | |
runs-on: "${{ matrix.os }}" | |
needs: [stage1] | |
if: needs.stage1.outputs.docs_changed == 'True' | |
steps: | |
- name: Checkout Repo | |
id: checkout-repo | |
uses: actions/checkout@v3 | |
# https://github.com/haskell/actions/tree/main/setup | |
- name: Set up Haskell Toolchain | |
id: setup-haskell-toolchain | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: "latest" | |
enable-stack: true | |
stack-version: "latest" | |
stack-setup-ghc: true | |
cabal-version: "latest" | |
cabal-update: true | |
- name: Check Versions | |
id: setup-haskell-check | |
run: | | |
stack --version | |
cabal --version | |
- name: Install Tools | |
id: setup-haskell-tools | |
run: | | |
stack install hlint | |
hlint --version | |
- name: CD to Haskell Dir | |
id: cd-to-haskell-dir | |
run: | | |
pwd | |
ls | |
cd ./haskell | |
pwd | |
ls | |
- name: Analysing the code with hlint | |
id: haskell-lint | |
run: | | |
cd ./haskell | |
./for_each hlint src --report | |
- name: Testing with coverage | |
id: haskell-test-coverage | |
run: |- | |
cd ./haskell | |
./for_each stack test --coverage |