Add a --dry-run build check of cabal.project.release
[cabal.git] / .github / workflows / quick-jobs.yml
blob19d4b5fd74f0677d5886e5e6e7ba663d7d1ccf9f
1 name: Quick jobs
3 # See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
4 concurrency:
5   group: ${{ github.ref }}-${{ github.workflow }}
6   cancel-in-progress: true
8 on:
9   push:
10     branches:
11       - master
12   pull_request:
13   release:
14     types:
15       - created
17 jobs:
18   meta:
19     name: Meta checks
20     runs-on: ubuntu-latest
21     # This job is not run in a container, any recent GHC should be fine
22     steps:
23       - name: Set PATH
24         # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
25         run: |
26           echo "$HOME/.cabal/bin" >> $GITHUB_PATH
27       - uses: actions/cache@v3
28         with:
29           path: ~/.cabal/store
30           key: linux-store-meta
31       # See https://github.com/haskell/cabal/pull/8739
32       - name: Sudo chmod to permit ghcup to update its cache
33         run: |
34           if [[ "${{ runner.os }}" == "Linux" ]]; then
35             sudo ls -lah /usr/local/.ghcup/cache
36             sudo mkdir -p /usr/local/.ghcup/cache
37             sudo ls -lah /usr/local/.ghcup/cache
38             sudo chown -R $USER /usr/local/.ghcup
39             sudo chmod -R 777 /usr/local/.ghcup
40           fi
41       - name: ghcup
42         run: |
43           ghcup --version
44           ghcup config set cache true
45           ghcup install ghc recommended
46           ghcup set ghc recommended
47       - name: Update Hackage index
48         run: cabal v2-update
49       - name: Install alex
50         run: cabal v2-install alex --constraint='alex ==3.2.7.3'
51       - uses: actions/checkout@v4
52       - name: Regenerate files
53         run: |
54           make -B lexer
55           make -B spdx
56           make -B templates
57       - name: Check that diff is clean
58         run: |
59           git status > /dev/null
60           git diff-files -p --exit-code
61   doctest:
62     name: Doctest Cabal
63     runs-on: ubuntu-latest
64     steps:
65       - name: Set PATH
66         run: |
67           echo "$HOME/.cabal/bin" >> $GITHUB_PATH
68       - uses: actions/cache@v3
69         with:
70           path: ~/.cabal/store
71           key: linux-store-doctest
72       # See https://github.com/haskell/cabal/pull/8739
73       - name: Sudo chmod to permit ghcup to update its cache
74         run: |
75           if [[ "${{ runner.os }}" == "Linux" ]]; then
76             sudo ls -lah /usr/local/.ghcup/cache
77             sudo mkdir -p /usr/local/.ghcup/cache
78             sudo ls -lah /usr/local/.ghcup/cache
79             sudo chown -R $USER /usr/local/.ghcup
80             sudo chmod -R 777 /usr/local/.ghcup
81           fi
82       - name: ghcup
83         run: |
84           ghcup --version
85           ghcup config set cache true
86           ghcup install ghc --set recommended
87           ghcup install cabal --set latest
88       - name: Update Hackage index
89         run: cabal v2-update
90       - uses: actions/checkout@v4
91       - name: Install doctest
92         run: make doctest-install
93       - name: Doctest
94         run: make doctest
95   buildinfo:
96     name: Check Field Syntax Reference
97     runs-on: ubuntu-latest
98     steps:
99       - name: Set PATH
100         run: |
101           echo "$HOME/.cabal/bin" >> $GITHUB_PATH
102       - uses: actions/cache@v3
103         with:
104           path: ~/.cabal/store
105           key: linux-store-buildinfo-doc-diff
106       # See https://github.com/haskell/cabal/pull/8739
107       - name: Sudo chmod to permit ghcup to update its cache
108         run: |
109           if [[ "${{ runner.os }}" == "Linux" ]]; then
110             sudo ls -lah /usr/local/.ghcup/cache
111             sudo mkdir -p /usr/local/.ghcup/cache
112             sudo ls -lah /usr/local/.ghcup/cache
113             sudo chown -R $USER /usr/local/.ghcup
114             sudo chmod -R 777 /usr/local/.ghcup
115           fi
116       - name: ghcup
117         run: |
118           ghcup --version
119           ghcup config set cache true
120           ghcup install ghc --set recommended
121           ghcup install cabal --set latest
122       - name: Update Hackage index
123         run: cabal v2-update
124       - uses: actions/checkout@v4
125       - name: Are buildinfo docs up to date?
126         run: make doc/buildinfo-fields-reference.rst
127   release-project:
128     name: Check Release Project
129     runs-on: ubuntu-latest
130     steps:
131       - name: Set PATH
132         run: |
133           echo "$HOME/.cabal/bin" >> $GITHUB_PATH
134       - name: ghcup
135         run: |
136           ghcup --version
137           ghcup config set cache true
138           ghcup install ghc --set recommended
139           ghcup install cabal --set latest
140       - name: Update Hackage index
141         run: cabal v2-update
142       - uses: actions/checkout@v4
143       - name: Check release project
144         run: cabal build all --enable-tests --enable-benchmarks --dry-run --project-file=cabal.project.release --index-state="hackage.haskell.org HEAD"