Fix issue/PR templates (#9117)
[cabal.git] / .github / workflows / bootstrap.yml
blob74a1d857f58e19d420bd8e12e7328113ab0fdcf9
1 name: Bootstrap
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   bootstrap:
19     strategy:
20       matrix:
21         os: [ubuntu-latest]
22         ghc: ["8.10.7", "9.0.2", "9.2.7", "9.4.4"]
23         include:
24           - os: macos-latest
25             ghc: "9.2.7"
26     name: Bootstrap ${{ matrix.os }} ghc-${{ matrix.ghc }}
27     runs-on: ${{ matrix.os }}
28     steps:
29       - uses: actions/cache@v3
30         name: Cache the downloads
31         id: bootstrap-cache
32         with:
33           path: "/home/runner/work/cabal/cabal/_build"
34           key: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-${{ github.sha }}
35           restore-keys: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-
37       - uses: actions/checkout@v3
38       # See https://github.com/haskell/cabal/pull/8739
39       - name: Sudo chmod to permit ghcup to update its cache
40         run: |
41           if [[ "${{ runner.os }}" == "Linux" ]]; then
42             sudo ls -lah /usr/local/.ghcup/cache
43             sudo mkdir -p /usr/local/.ghcup/cache
44             sudo ls -lah /usr/local/.ghcup/cache
45             sudo chown -R $USER /usr/local/.ghcup
46             sudo chmod -R 777 /usr/local/.ghcup
47           fi
48       - name: bootstrap.py
49         run: |
50           GHC_VERSION=${{ matrix.ghc }}
51           ghcup --version
52           ghcup config set cache true
53           ghcup install ghc $GHC_VERSION
55           # Fetch the bootstrap sources (we use linux dependencies also on macos)
56           python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc $GHC_VERSION) -d bootstrap/linux-$GHC_VERSION.json fetch
58           # Bootstrap using the bootstrap sources
59           python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc $GHC_VERSION) --bootstrap-sources bootstrap-sources.tar.gz
61       - name: Smoke test
62         run: |
63           _build/bin/cabal --version
65       - uses: actions/upload-artifact@v3
66         with:
67           name: cabal-${{ matrix.os }}-${{ matrix.ghc }}-bootstrapped
68           path: _build/artifacts/*