2025-01-23 16:07:49 -06:00
|
|
|
name: Test, Build, and Release
|
2025-01-21 13:29:52 -06:00
|
|
|
|
2025-01-23 16:27:24 -06:00
|
|
|
on:
|
2025-01-21 13:29:52 -06:00
|
|
|
push:
|
2025-01-23 16:27:24 -06:00
|
|
|
tags:
|
|
|
|
- '*'
|
2025-01-21 13:29:52 -06:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
container:
|
2025-01-21 16:49:15 -06:00
|
|
|
image: docker.matri.cx/nix-runner:v0.1.0
|
2025-01-21 13:29:52 -06:00
|
|
|
credentials:
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
steps:
|
2025-01-23 16:27:24 -06:00
|
|
|
- uses: actions/checkout@v3
|
2025-01-23 16:07:49 -06:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2025-01-21 13:29:52 -06:00
|
|
|
|
|
|
|
- name: Set up cache for Cabal
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
2025-01-21 16:28:35 -06:00
|
|
|
~/.cache/cabal
|
2025-01-21 16:58:04 -06:00
|
|
|
~/.config/cabal
|
|
|
|
~/.local/state/cabal
|
|
|
|
key: cabal-${{ hashFiles('tricu.cabal') }}
|
2025-01-21 13:29:52 -06:00
|
|
|
restore-keys: |
|
2025-01-21 16:58:04 -06:00
|
|
|
cabal-
|
2025-01-21 13:29:52 -06:00
|
|
|
|
|
|
|
- name: Set up cache for Nix
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
/nix/store
|
|
|
|
/nix/var/nix/cache
|
2025-01-21 16:58:04 -06:00
|
|
|
key: nix-${{ hashFiles('flake.lock') }}
|
2025-01-21 13:29:52 -06:00
|
|
|
restore-keys: |
|
2025-01-21 16:58:04 -06:00
|
|
|
nix-
|
2025-01-21 13:29:52 -06:00
|
|
|
|
|
|
|
- name: Initialize Cabal and update package list
|
|
|
|
run: |
|
|
|
|
nix develop --command cabal update
|
|
|
|
|
2025-01-21 16:28:35 -06:00
|
|
|
- name: Run test suite
|
2025-01-21 13:29:52 -06:00
|
|
|
run: |
|
|
|
|
nix develop --command cabal test
|
|
|
|
|
|
|
|
build:
|
|
|
|
needs: test
|
|
|
|
container:
|
2025-01-21 16:49:15 -06:00
|
|
|
image: docker.matri.cx/nix-runner:v0.1.0
|
2025-01-21 13:29:52 -06:00
|
|
|
credentials:
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
steps:
|
2025-01-23 16:20:06 -06:00
|
|
|
- uses: actions/checkout@v3
|
2025-01-21 13:29:52 -06:00
|
|
|
with:
|
2025-01-23 16:07:49 -06:00
|
|
|
fetch-depth: 0
|
2025-01-23 16:20:06 -06:00
|
|
|
|
2025-01-21 13:29:52 -06:00
|
|
|
- name: Set up cache for Nix
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
/nix/store
|
|
|
|
/nix/var/nix/cache
|
2025-01-21 16:58:04 -06:00
|
|
|
key: nix-${{ hashFiles('flake.lock') }}
|
2025-01-21 13:29:52 -06:00
|
|
|
restore-keys: |
|
2025-01-21 16:58:04 -06:00
|
|
|
nix-
|
2025-01-23 16:07:49 -06:00
|
|
|
|
2025-01-21 13:29:52 -06:00
|
|
|
- name: Build binary
|
|
|
|
run: |
|
|
|
|
nix build
|
|
|
|
ls -alh ./result/bin/tricu
|
2025-01-23 16:07:49 -06:00
|
|
|
|
2025-01-23 16:20:06 -06:00
|
|
|
- name: Setup go for release actoin
|
|
|
|
uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: '>=1.20.1'
|
|
|
|
|
2025-01-23 16:30:35 -06:00
|
|
|
- name: Release binary
|
|
|
|
uses: https://gitea.com/actions/release-action@main
|
|
|
|
with:
|
|
|
|
files: |-
|
|
|
|
./result/bin/tricu
|
|
|
|
api_key: '${{ secrets.RELEASE_TOKEN }}'
|