Merge pull request #10592 from cabalism/typo/respositories
[cabal.git] / .github / workflows / quick-jobs.yml
blob82c3fbd1244ca1cf7aa721f5a787a6dfc7413f3e
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 env:
18   GHC_FOR_QUICK_JOBS: 9.6.5
20 jobs:
21   meta:
22     name: Meta checks
23     runs-on: ubuntu-latest
24     env:
25       cabal_build: >-
26         cabal build --builddir=dist-newstyle-meta --project-file=cabal.meta.project
27         gen-cabal-macros
28         gen-paths-module
29         gen-spdx
30         gen-spdx-exc
31     steps:
32       - name: Install primary compiler
33         uses: haskell-actions/setup@v2
34         id: setup-haskell
35         with:
36           ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }}
37           cabal-version: latest
38       - name: Haskell versions
39         run: |
40           ghc --version
41           cabal --version
42       - name: Update Hackage index
43         run: cabal v2-update
44       - uses: actions/checkout@v4
45       - name: Generate build plan for correct cache key
46         run: ${{ env.cabal_build }} --dry-run
47       - name: Restore cached dependencies
48         uses: actions/cache/restore@v4
49         id: cache
50         with:
51           path: ~/.local/state/cabal
52           key: linux-store-meta-${{ hashfiles('dist-newstyle-meta/cache/plan.json') }}
53           restore-keys: linux-store-meta-
54       - name: Build tools
55         run: ${{ env.cabal_build }}
56       - name: Regenerate files
57         run: |
58           make -B spdx
59           make -B templates
60       - name: Check that diff is clean
61         run: |
62           git status > /dev/null
63           git diff-files -p --exit-code
64       - name: Cache dependencies
65         uses: actions/cache/save@v4
66         if: always() && steps.cache.outputs.cache-hit != 'true'
67         with:
68           path: ~/.local/state/cabal
69           key: ${{ steps.cache.outputs.cache-primary-key }}
71   doctest:
72     name: Doctest Cabal
73     runs-on: ubuntu-latest
74     steps:
75       - name: Install primary compiler
76         uses: haskell-actions/setup@v2
77         id: setup-haskell
78         with:
79           ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }}
80           cabal-version: latest
81       - name: Haskell versions
82         run: |
83           ghc --version
84           cabal --version
85       # It is complicated to get a proper cache key for the dependencies of a package
86       # (here: doctest) that we just `cabal install`.
87       # So, as a heuristics we update the cache once per day.
88       # Updating it with each run would be an alternative, but we a short of cache space,
89       # and this would generate too many new caches.
90       - name: Use date as cache key
91         run: |
92           echo "DATE=$(date +'%Y-%m-%d')" >> "${GITHUB_ENV}"
93       - name: Restore cached dependencies
94         uses: actions/cache/restore@v4
95         id: cache
96         with:
97           path: ~/.local/state/cabal
98           key: linux-store-doctest-${{ env.DATE }}
99           restore-keys: linux-store-doctest
100       - name: Update Hackage index
101         run: cabal v2-update
102       - uses: actions/checkout@v4
103       - name: Install doctest
104         run: make doctest-install
105       - name: Doctest
106         run: make doctest
107       - name: Cache dependencies
108         if: always() && steps.cache.outputs.cache-hit != 'true'
109         uses: actions/cache/save@v4
110         with:
111           path: ~/.local/state/cabal
112           key: ${{ steps.cache.outputs.cache-primary-key }}
114   buildinfo:
115     name: Check Field Syntax Reference
116     runs-on: ubuntu-latest
117     env:
118       cabal_build: cabal build buildinfo-reference-generator
119     steps:
120       - name: Install primary compiler
121         uses: haskell-actions/setup@v2
122         id: setup-haskell
123         with:
124           ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }}
125           cabal-version: latest
126       - name: Haskell versions
127         run: |
128           ghc --version
129           cabal --version
130       - name: Update Hackage index
131         run: cabal v2-update
132       - uses: actions/checkout@v4
133       - name: Generate build plan for correct cache key
134         run: ${{ env.cabal_build }} --dry-run
135       - name: Restore cached dependencies
136         uses: actions/cache/restore@v4
137         id: cache
138         with:
139           path: ~/.local/state/cabal
140           key: linux-store-buildinfo-doc-diff-${{ hashfiles('dist-newstyle/cache/plan.json') }}
141           restore-keys: linux-store-buildinfo-doc-diff
142       - name: Build buildinfo-reference-generator
143         run: ${{ env.cabal_build }}
144       - name: Are buildinfo docs up to date?
145         run: make doc/buildinfo-fields-reference.rst
146       - name: Cache dependencies
147         uses: actions/cache/save@v4
148         if: always() && steps.cache.outputs.cache-hit != 'true'
149         with:
150           path: ~/.local/state/cabal
151           key: ${{ steps.cache.outputs.cache-primary-key }}
153   release-project:
154     name: Check Release Project
155     runs-on: ubuntu-latest
156     steps:
157       - name: Install primary compiler
158         uses: haskell-actions/setup@v2
159         id: setup-haskell
160         with:
161           ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }}
162           cabal-version: latest
163       - name: Haskell versions
164         run: |
165           ghc --version
166           cabal --version
167       - name: Update Hackage Index
168         run: cabal v2-update
169       - uses: actions/checkout@v4
170       - name: Check Release with Pinned Hackage
171         run: cabal build all --dry-run --project-file=cabal.release.project
172       - name: Check Release with Latest Hackage
173         run: cabal build all --dry-run --project-file=cabal.release.project --index-state="hackage.haskell.org HEAD"