Skip to content

ci: try to avoid saving cache if no change and try pulling image #3

ci: try to avoid saving cache if no change and try pulling image

ci: try to avoid saving cache if no change and try pulling image #3

Workflow file for this run

name: main
env:
LANG: C.UTF-8
on:
push:
branches: main
pull_request:
branches: main
permissions:
contents: write
jobs:
build-and-deploy:
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
ghc-version: ['9.6.6']
cabal-version: ['3.12.1.0']
steps:
- uses: actions/checkout@v4
- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell-actions/setup@v2
# https://github.com/marketplace/actions/setup-haskell
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
cabal-version: ${{ matrix.cabal-version }}
cabal-update: true
- name: Restore cached dependencies
uses: actions/cache/restore@v4
# https://github.com/actions/cache/blob/main/restore/README.md
id: cache
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc-version }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-ghc-${{ matrix.ghc-version }}-
- name: Install dependencies
run: cabal build all --only-dependencies
- name: Save cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v4
# https://github.com/actions/cache/blob/main/examples.md#haskell---cabal
if: ${{ !steps.cache.outputs.cache-hit

Check failure on line 56 in .github/workflows/main.yaml

View workflow run for this annotation

GitHub Actions / main

Invalid workflow file

The workflow is not valid. .github/workflows/main.yaml (Line: 56, Col: 13): The expression is not closed. An unescaped ${{ sequence was found, but the closing }} sequence was not found.
|| steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc-version }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc-version }}-
- name: Build
run: cabal build all
- name: Run tests
run: cabal test all
- name: Check cabal file
run: cabal check
- name: Build documentation
run: cabal haddock all
- name: Build static binary
run: |
cd release && \
docker pull ghcr.io/spex-lang/spex-static-build && \
docker run \
-v "${PWD}/..":/mnt/:ro \
-v "~/.cabal/packages":/root/.cache/cabal/packages \
-v "~/cabal/store":/root/.local/state/cabal/store \
-v "${PWD}/dist-newstyle":/mnt/dist-newstyle \
ghcr.io/spex-lang/spex-static-build
# - name: Create new git tag, if merge to master and .cabal version is bumped
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# uses: sol/haskell-autotag@v1
# id: autotag
# - name: Create tarball
# run: cabal sdist
# - uses: haskell-actions/[email protected]
# with:
# # http://hackage.haskell.org/users/account-management
# hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
# publish: true
# if: steps.autotag.outputs.created