This commit is contained in:
2026-03-09 08:54:30 -04:00
commit 1f75b6f396
18 changed files with 866 additions and 0 deletions

46
.github/README.md vendored Normal file
View File

@@ -0,0 +1,46 @@
# zig template
[![check](https://img.shields.io/github/actions/workflow/status/spotdemo4/zig-template/check.yaml?branch=main&logo=github&logoColor=%23bac2de&label=check&labelColor=%23313244)](https://github.com/spotdemo4/zig-template/actions/workflows/check.yaml)
[![vulnerable](https://img.shields.io/github/actions/workflow/status/spotdemo4/zig-template/vulnerable.yaml?branch=main&logo=github&logoColor=%23bac2de&label=vulnerable&labelColor=%23313244)](https://github.com/spotdemo4/zig-template/actions/workflows/vulnerable.yaml)
[![nix](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fspotdemo4%2Fzig-template%2Frefs%2Fheads%2Fmain%2Fflake.lock&query=%24.nodes.nixpkgs.original.ref&logo=nixos&logoColor=%23bac2de&label=channel&labelColor=%23313244&color=%234d6fb7)](https://nixos.org/)
[![zig](<https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fraw.githubusercontent.com%2Fspotdemo4%2Fzig-template%2Frefs%2Fheads%2Fmain%2Fbuild.zig.zon&search=.minimum_zig_version%20%3D%20%22(.*)%22&replace=%241&logo=zig&logoColor=%23bac2de&label=zig&labelColor=%23313244&color=%23F7A41D>)](https://ziglang.org/)
template for [zig](https://ziglang.org/)
part of [spotdemo4/templates](https://github.com/spotdemo4/templates)
## requirements
- [nix](https://nixos.org/)
- [direnv](https://direnv.net/) (optional)
## getting started
initialize direnv:
```elm
ln -s .envrc.project .envrc &&
direnv allow
```
or manually enter the development environment:
```elm
nix develop
```
### check
```elm
nix flake check
```
### release
releases are automatically created for [significant](https://www.conventionalcommits.org/en/v1.0.0/#summary) changes
to manually create a version bump:
```elm
bumper
```

34
.github/renovate.json vendored Normal file
View File

@@ -0,0 +1,34 @@
{
"$schema": "https://docs.renovatebot.com/renovate-global-schema.json",
// self-hosted
"onboarding": false,
"requireConfig": "ignored",
"platform": "github",
"repositories": ["spotdemo4/zig-template"],
// repository
"extends": ["config:recommended"],
"lockFileMaintenance": {
"enabled": true,
"automerge": true,
"schedule": ["* * * * 0"] // sunday
},
"nix": {
"enabled": true
},
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"matchManagers": ["nix"],
"groupName": "nix inputs"
},
{
"matchManagers": ["github-actions"],
"groupName": "github actions"
}
]
}

39
.github/workflows/bump.yaml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: bump
on:
schedule:
- cron: "0 22 * * 1-5" # every weekday at 22:00 UTC
workflow_dispatch:
inputs:
force:
description: "force"
required: false
type: choice
default: "true"
options:
- "true"
- "false"
concurrency:
group: release
permissions:
contents: read
id-token: write
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: spotdemo4/nix-init@5fe5a93e1ff2a6a4cfba1ae7d3f30d0dfed9d1a9 # v1.34.1
with:
app_id: ${{ vars.CLIENT_ID }}
app_key: ${{ secrets.PRIVATE_KEY }}
fetch_depth: 0
shell: bump
- name: Bump
run: bumper
env:
FORCE: ${{ inputs.force }}

25
.github/workflows/check.yaml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: check
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
permissions:
contents: read
id-token: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: spotdemo4/nix-init@5fe5a93e1ff2a6a4cfba1ae7d3f30d0dfed9d1a9 # v1.34.1
- name: Check
run: nix flake check

35
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: release
on:
push:
tags: ["v*"]
workflow_dispatch:
concurrency:
group: release
permissions:
contents: read
id-token: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout
uses: spotdemo4/nix-init@5fe5a93e1ff2a6a4cfba1ae7d3f30d0dfed9d1a9 # v1.34.1
with:
app_id: ${{ vars.CLIENT_ID }}
app_key: ${{ secrets.PRIVATE_KEY }}
fetch_depth: 0
shell: release
- name: Release
run: flake-release
env:
GITHUB_TOKEN: ${{ steps.checkout.outputs.token }}
REGISTRY: ghcr.io
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

29
.github/workflows/update.yaml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: update
on:
schedule:
- cron: "0 9 * * *" # every day at 09:00 UTC
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
renovate:
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout
uses: spotdemo4/nix-init@5fe5a93e1ff2a6a4cfba1ae7d3f30d0dfed9d1a9 # v1.34.1
with:
app_id: ${{ vars.CLIENT_ID }}
app_key: ${{ secrets.PRIVATE_KEY }}
shell: update
- name: Renovate
run: renovate
env:
RENOVATE_CONFIG_FILE: .github/renovate.json
RENOVATE_TOKEN: ${{ steps.checkout.outputs.token }}
LOG_LEVEL: ${{ runner.debug == '1' && 'debug' || 'info' }}

33
.github/workflows/vulnerable.yaml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: vulnerable
on:
schedule:
- cron: "0 9 * * 0" # every Sunday at 09:00 UTC
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
flake:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: spotdemo4/nix-init@5fe5a93e1ff2a6a4cfba1ae7d3f30d0dfed9d1a9 # v1.34.1
with:
shell: vulnerable
- name: Run flake-checker
run: flake-checker -f
actions:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: spotdemo4/nix-init@5fe5a93e1ff2a6a4cfba1ae7d3f30d0dfed9d1a9 # v1.34.1
with:
shell: vulnerable
- name: Run octoscan
run: find .github/workflows -exec octoscan scan {} \;