tricu/.gitea/workflows/test-and-build.yml

87 lines
2.1 KiB
YAML
Raw Normal View History

2025-01-23 16:07:49 -06:00
name: Test, Build, and Release
on:
push:
branches:
- main
jobs:
test:
container:
2025-01-21 16:49:15 -06:00
image: docker.matri.cx/nix-runner:v0.1.0
credentials:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v3
2025-01-23 16:07:49 -06:00
with:
fetch-depth: 0
- name: Set up cache for Cabal
uses: actions/cache@v4
with:
path: |
2025-01-21 16:28:35 -06:00
~/.cache/cabal
~/.config/cabal
~/.local/state/cabal
key: cabal-${{ hashFiles('tricu.cabal') }}
restore-keys: |
cabal-
- name: Set up cache for Nix
uses: actions/cache@v4
with:
path: |
/nix/store
/nix/var/nix/cache
key: nix-${{ hashFiles('flake.lock') }}
restore-keys: |
nix-
- 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
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
credentials:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
2025-01-23 16:07:49 -06:00
fetch-depth: 0
- name: Set up cache for Nix
uses: actions/cache@v4
with:
path: |
/nix/store
/nix/var/nix/cache
key: nix-${{ hashFiles('flake.lock') }}
restore-keys: |
nix-
2025-01-23 16:07:49 -06:00
- name: Build binary
run: |
nix build
ls -alh ./result/bin/tricu
2025-01-23 16:07:49 -06:00
- name: Release binary
uses: https://gitea.com/actions/release-action@main
with:
files: |-
./result/bin/tricu
api_key: '${{ secrets.RELEASE_TOKEN }}'
tag: $(git rev-parse --short HEAD)
title: "Release $(git rev-parse --short HEAD)"
note: "Automated release for commit $(git rev-parse --short HEAD)"