more ci fiddling #410
This file contains 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: "CI" | |
on: | |
pull_request: | |
push: | |
jobs: | |
dockerimage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: project-m36 | |
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" | |
- run: cachix use iohk | |
- name: docker load | |
run: docker load < $(nix-build docker.nix) | |
- name: docker login | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: echo ${{secrets.DOCKERHUB_PASSWORD}} | docker login --username ${{secrets.DOCKERHUB_USER}} --password-stdin | |
- name: docker tag with version | |
run: docker tag project-m36:latest projectm36/project-m36:$(awk '/^Version:/ {print $2}' project-m36.cabal) | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: docker tag latest | |
run: docker tag project-m36:latest projectm36/project-m36:latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- run: docker push projectm36/project-m36 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
stack-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
ghc: | |
- ghc9.2.8 | |
- ghc9.4.7 | |
include: | |
- os: macos-latest | |
ghc: ghc9.2 | |
env: | |
STACK_YAML: stack.${{ matrix.ghc }}.yaml | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-build-stack-${{ matrix.ghc }}-${{ hashFiles(env.STACK_YAML) }}-${{ hashFiles('**/*.cabal') }} | |
restore-keys: | | |
${{ runner.os }}-build-stack-${{ matrix.ghc }}-${{ hashFiles(env.STACK_YAML) }} | |
${{ runner.os }}-build-stack-${{ matrix.ghc }} | |
- name: Fix macOS cache bug | |
run: rm -rf ~/.stack/setup-exe-cache | |
# - name: HLint | |
# run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . | |
- name: Setup Stack | |
run: curl -sSL https://get.haskellstack.org/ | sh | |
- name: Build | |
run: stack build --ghc-options -O2 --local-bin-path out --copy-bins | |
- name: Test | |
run: stack test --stack-yaml=${{ env.STACK_YAML }} | |
- name: Haddock | |
run: stack --no-install-ghc --system-ghc --no-haddock-deps haddock | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: project-m36-${{ matrix.os }}-${{ matrix.ghc }} | |
path: out/ |