Soulomoon/refactor session #115
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
name: Flags | |
defaults: | |
run: | |
shell: bash | |
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. | |
concurrency: | |
group: ${{ github.head_ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
pre_job: | |
runs-on: ubuntu-latest | |
outputs: | |
ghcs: ${{ steps.ghcs.outputs.ghcs }} | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
# Need the repo checked out in order to read the file | |
- uses: actions/checkout@v3 | |
- id: ghcs | |
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5.3.1 | |
with: | |
cancel_others: false | |
paths_ignore: '[ "**/docs/**" | |
, "**.md" | |
, "**/LICENSE" | |
, "**.nix" | |
, "flake.lock" | |
, "**/README.md" | |
, "FUNDING.yml" | |
, ".circleci/**" | |
, "**/stack*.yaml" | |
, ".gitlab-ci.yaml" | |
, ".gitlab/**" | |
]' | |
flags: | |
if: needs.pre_job.outputs.should_skip != 'true' | |
needs: pre_job | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
ghc: ${{ fromJSON(needs.pre_job.outputs.ghcs) }} | |
os: | |
- ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# By default, the `pull_request` event has a `GITHUB_SHA` env variable | |
# set to the "last merge commit on the GITHUB_REF branch" (see | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request). | |
# But we want to check out the latest commit on the branch whether or | |
# not it is a merge commit, so this is how we do that. | |
ref: "${{ github.event.pull_request.head.sha }}" | |
- uses: ./.github/actions/setup-build | |
with: | |
ghc: ${{ matrix.ghc }} | |
os: ${{ runner.os }} | |
# The purpose of this job is to ensure that the build works even with flags | |
# in their non-default settings. Below we: | |
# - enable flags that are off by default | |
# - disable flags that are on by default | |
- name: Configue non-default flags for all components | |
run: | | |
cabal configure \ | |
--constraint "haskell-language-server +pedantic" \ | |
--constraint "hls-graph +embed-files +pedantic +stm-stats" \ | |
--constraint "ghcide +ekg +executable +test-exe" \ | |
--constraint "hls-plugin-api +pedantic -use-fingertree" | |
cat cabal.project.local | |
- name: Build everything with non-default flags | |
run: cabal build all | |
flags_post_job: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: [pre_job, flags] | |
steps: | |
- run: | | |
echo "jobs info: ${{ toJSON(needs) }}" | |
- if: contains(needs.*.result, 'failure') | |
run: exit 1 | |
- if: contains(needs.*.result, 'cancelled') && needs.pre_job.outputs.should_skip != 'true' | |
run: exit 1 |