-
-
Notifications
You must be signed in to change notification settings - Fork 367
98 lines (87 loc) · 3.18 KB
/
flags.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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