packages feed

hackport-0.9.0.0: cabal/.github/workflows/bootstrap.yml

name: Bootstrap

# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
concurrency:
  group: ${{ github.ref }}-${{ github.workflow }}
  cancel-in-progress: true

on:
  push:
    branches:
      - master
  pull_request:
  release:
    types:
      - created

jobs:
  bootstrap:
    strategy:
      matrix:
        os: [ubuntu-latest]
        ghc: ["8.10.7", "9.0.2", "9.2.8", "9.4.8"]
        include:
          - os: macos-latest
            ghc: "9.2.8"
    name: Bootstrap ${{ matrix.os }} ghc-${{ matrix.ghc }}
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/cache@v3
        name: Cache the downloads
        id: bootstrap-cache
        with:
          path: "/home/runner/work/cabal/cabal/_build"
          key: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-${{ github.sha }}
          restore-keys: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-

      - uses: actions/checkout@v3
      # See https://github.com/haskell/cabal/pull/8739
      - name: Sudo chmod to permit ghcup to update its cache
        run: |
          if [[ "${{ runner.os }}" == "Linux" ]]; then
            sudo ls -lah /usr/local/.ghcup/cache
            sudo mkdir -p /usr/local/.ghcup/cache
            sudo ls -lah /usr/local/.ghcup/cache
            sudo chown -R $USER /usr/local/.ghcup
            sudo chmod -R 777 /usr/local/.ghcup
          fi
      - name: bootstrap.py
        run: |
          GHC_VERSION=${{ matrix.ghc }}
          ghcup --version
          ghcup config set cache true
          ghcup install ghc $GHC_VERSION

          # Fetch the bootstrap sources (we use linux dependencies also on macos)
          python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc $GHC_VERSION) -d bootstrap/linux-$GHC_VERSION.json fetch

          # Bootstrap using the bootstrap sources
          python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc $GHC_VERSION) --bootstrap-sources bootstrap-sources.tar.gz

      - name: Smoke test
        run: |
          _build/bin/cabal --version

      - uses: actions/upload-artifact@v3
        with:
          name: cabal-${{ matrix.os }}-${{ matrix.ghc }}-bootstrapped
          path: _build/artifacts/*