87 lines
2.1 KiB
YAML
87 lines
2.1 KiB
YAML
|
name: Test and Build
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches:
|
||
|
- main
|
||
|
pull_request:
|
||
|
types:
|
||
|
- opened
|
||
|
- synchronize
|
||
|
|
||
|
jobs:
|
||
|
test:
|
||
|
container:
|
||
|
image: docker.matri.cx/nix-runner:latest
|
||
|
credentials:
|
||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v3
|
||
|
|
||
|
- name: Set up cache for Cabal
|
||
|
uses: actions/cache@v4
|
||
|
with:
|
||
|
path: |
|
||
|
~/.cabal
|
||
|
~/.ghc
|
||
|
key: cabal-${{ runner.os }}-${{ hashFiles('tricu.cabal') }}
|
||
|
restore-keys: |
|
||
|
cabal-${{ runner.os }}-
|
||
|
|
||
|
- name: Set up cache for Nix
|
||
|
uses: actions/cache@v4
|
||
|
with:
|
||
|
path: |
|
||
|
/nix/store
|
||
|
/nix/var/nix/cache
|
||
|
key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
|
||
|
restore-keys: |
|
||
|
nix-${{ runner.os }}-
|
||
|
|
||
|
- name: Initialize Cabal and update package list
|
||
|
run: |
|
||
|
nix develop --command cabal update
|
||
|
|
||
|
- name: Install dependencies and run tests
|
||
|
run: |
|
||
|
nix develop --command cabal test
|
||
|
|
||
|
build:
|
||
|
needs: test
|
||
|
container:
|
||
|
image: docker.matri.cx/nix-runner:latest
|
||
|
credentials:
|
||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v3
|
||
|
|
||
|
- name: Set up cache for Cabal
|
||
|
uses: actions/cache@v4
|
||
|
with:
|
||
|
path: |
|
||
|
~/.cabal
|
||
|
~/.ghc
|
||
|
key: cabal-${{ runner.os }}-${{ hashFiles('tricu.cabal') }}
|
||
|
restore-keys: |
|
||
|
cabal-${{ runner.os }}-
|
||
|
|
||
|
- name: Set up cache for Nix
|
||
|
uses: actions/cache@v4
|
||
|
with:
|
||
|
path: |
|
||
|
/nix/store
|
||
|
/nix/var/nix/cache
|
||
|
key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
|
||
|
restore-keys: |
|
||
|
nix-${{ runner.os }}-
|
||
|
|
||
|
- name: Build binary
|
||
|
run: |
|
||
|
nix build
|
||
|
ls -alh ./result/bin/tricu
|
||
|
|