Build against latest Stackage nightly #283
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build against latest Stackage nightly | |
| on: | |
| push: | |
| branches: | |
| main | |
| schedule: | |
| # Run this workflow every Tuesday at 4:44 AM UTC | |
| - cron: "44 4 * * 2" | |
| jobs: | |
| build-nightly: | |
| runs-on: ubuntu-latest | |
| name: Build against latest Stackage nightly | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Overwrite stack.yaml to use latest nightly | |
| shell: bash | |
| run: | | |
| result="$(curl -sSL -b /dev/null -o /dev/null -w '%{http_code} %{url_effective}' 'https://www.stackage.org/nightly')" | |
| regex='^200 https://www\.stackage\.org/(nightly-20..-..-..)$' | |
| if [[ $result =~ $regex ]]; then | |
| release=${BASH_REMATCH[1]} | |
| perl -pi -e "s/^resolver: .+/resolver: $release/" stack.yaml | |
| echo "Using Stackage $release" | |
| else | |
| echo 'Could not look up the latest Stackage nightly' | |
| exit 1 | |
| fi | |
| - name: Retrieve .stack from cache | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-stack-work | |
| with: | |
| path: "~/.stack" | |
| key: "stack-${{ runner.os }}-nightly-${{ hashFiles('stack.yaml') }}" | |
| restore-keys: | | |
| stack-${{ runner.os }}-nightly- | |
| stack-${{ runner.os }}- | |
| - name: Set up Haskell | |
| uses: haskell-actions/setup@v2.7.9 | |
| with: | |
| ghc-version: latest | |
| enable-stack: true | |
| stack-version: latest | |
| - name: Build | |
| run: | | |
| echo "::group::Show stack.yaml" | |
| cat stack.yaml | |
| echo "::endgroup::" | |
| stack --no-terminal build --no-run-benchmarks |