iocaine/.forgejo/workflows/build.yaml
Gergely Nagy ff9c31d326
Some checks failed
build / binary (push) Has been cancelled
build / binary-static (push) Has been cancelled
build / container (push) Has been cancelled
build / clippy (push) Has been cancelled
lint / linting (push) Has been cancelled
ci: Run the build workflow when tests change
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-30 21:30:39 +01:00

127 lines
3.2 KiB
YAML

## SPDX-FileCopyrightText: 2025 Gergely Nagy
## SPDX-FileContributor: Gergely Nagy
##
## SPDX-License-Identifier: MIT
name: build
on:
push:
branches:
- 'main'
paths:
- '.forgejo/workflows/build.yaml'
- 'flake.nix'
- 'flake.lock'
- 'nix/**'
- 'Cargo.*'
- 'src/**'
- 'templates/**'
- 'tests/**'
jobs:
binary:
runs-on: nixos-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup magic attic cache
uses: actions/magic-attic-cache@main
with:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
- name: build
uses: actions/nix/build@main
with:
logs: true
package: iocaine
binary-static:
runs-on: nixos-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup magic attic cache
uses: actions/magic-attic-cache@main
with:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
- name: build
uses: actions/nix/build@main
with:
logs: true
package: iocaine-static
- name: compress the binary
uses: actions/nix/develop@main
with:
run: |
zstd result/bin/iocaine
- name: determine the version
uses: actions/nix/develop@main
id: ver
with:
run: |
echo "ver=$(cargo info -q iocaine | grep "^version:" | cut -d " " -f 2)" >>"${GITHUB_OUTPUT}"
- name: upload package
uses: actions/nix/develop@main
with:
run: |
curl --user :${{ secrets.DOCKER_PASSWORD }} -XDELETE \
https://git.madhouse-project.org/api/packages/algernon/generic/iocaine/${{ steps.ver.outputs.ver }}
curl --user :${{ secrets.DOCKER_PASSWORD }} \
--upload-file result/bin/iocaine.zst \
--fail \
https://git.madhouse-project.org/api/packages/algernon/generic/iocaine/${{ steps.ver.outputs.ver }}/iocaine.zst
container:
runs-on: nixos-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup magic attic cache
uses: actions/magic-attic-cache@main
with:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
- name: build the container image
uses: actions/nix/build@main
with:
logs: true
package: container-image
- name: load the container image into docker
run: |
docker load <result
- name: login to the container registry
uses: https://code.forgejo.org/docker/login-action@v2
with:
registry: git.madhouse-project.org
username: algernon
password: ${{ secrets.DOCKER_PASSWORD }}
- name: publish
run:
docker push git.madhouse-project.org/algernon/iocaine:latest
clippy:
runs-on: nixos-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup magic attic cache
uses: actions/magic-attic-cache@main
with:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
- name: clippy
uses: actions/nix/develop@main
with:
run: cargo clippy