To encourage organizing code in a way that helps in understanding, I have implemented the common idiom of requiring a `main` function. In tricu and other functional languages, it is usually placed near the top of the module. The evaluator gracefully handles the situation of passing multiple files where the intermediary "library" files do not have main functions.
66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
name: Test, Build, and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
test:
|
|
container:
|
|
image: docker.matri.cx/nix-runner:v0.1.0
|
|
credentials:
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up cache for Cabal
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/cabal
|
|
~/.config/cabal
|
|
~/.local/state/cabal
|
|
key: cabal-${{ hashFiles('tricu.cabal') }}
|
|
restore-keys: |
|
|
cabal-
|
|
|
|
- name: Initialize Cabal and update package list
|
|
run: |
|
|
nix develop --command cabal update
|
|
|
|
- name: Run test suite
|
|
run: |
|
|
nix develop --command cabal test
|
|
|
|
build:
|
|
needs: test
|
|
container:
|
|
image: docker.matri.cx/nix-runner:v0.1.0
|
|
credentials:
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Build and shrink binary
|
|
run: |
|
|
nix build
|
|
cp -L ./result/bin/tricu ./tricu
|
|
chmod 755 ./tricu
|
|
nix develop --command upx ./tricu
|
|
|
|
- name: Release binary
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
files: |-
|
|
./tricu
|
|
token: '${{ secrets.RELEASE_TOKEN }}'
|
|
body: '${{ gitea.event.head_commit.message }}'
|
|
pre_release: true
|