Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,23 @@
"commitMessageAction": "update",
"commitMessageTopic": "Nix flake lock"
}
}
},
"customManagers": [
{
"customType": "regex",
"managerFilePatterns": [
"/(^|/|\\.)Dockerfile$/",
"/(^|/)Dockerfile[^/]*$/"
],
"matchStringsStrategy": "recursive",
"matchStrings": [
"FROM\\s*.*?alpine[.:]?(?<alpineMajor>\\d+)\\.(?<alpineMinor>\\d+)(?:\\n|.)*",
"apk\\s+add\\s+(?:\\n|.)*?[^\\\\]\\n",
"(?<name>[^\\s=~]+)~?=(?<currentValue>[^\\s=]+)"
],
"datasourceTemplate": "repology",
"depNameTemplate": "alpine_{{alpineMajor}}_{{alpineMinor}}/{{name}}",
"versioningTemplate": "loose"
}
]
}
5 changes: 5 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ _subdirectory: rust
project_name:
type: str
help: What is the project name?

uses_git:
type: bool
default: false
help: Does the tool require Git? (e.g., for analyzing git history)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ jobs:
steps:
- name: Checkout code.
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
{%- if uses_git %}
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
{%- endif %}
- name: Setup Nix.
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
- name: Dogfooding Docker.
run: nix develop -c make dogfood-docker
run: nix develop -c make dogfood-docker{% if uses_git %} FROM="origin/${{ github.base_ref }}"{% endif %}
14 changes: 14 additions & 0 deletions rust/Dockerfile.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.23.2@sha256:865b95f46d98cf867a156fe4a135ad3fe50d2056aa3f25ed31662dff6da4eb62
{%- if uses_git %}

RUN apk add --no-cache \
git=2.52.0-r0 && \
git config --system --add safe.directory '*'
{%- endif %}

ARG TARGET
COPY ./target/${TARGET}/release/{{ project_name }} /usr/local/bin/

WORKDIR /workspace

ENTRYPOINT ["{{ project_name }}"]
2 changes: 1 addition & 1 deletion rust/Makefile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ GITHUB_ACTIONS_ENV := --env HOME=/github/home --env GITHUB_ACTIONS=true --env CI
.PHONY: dogfood-docker
dogfood-docker: release
docker build --build-arg TARGET=$(MUSL_TARGET) --tag {{ project_name }} --file Dockerfile .
docker run --rm --volume $(PWD):/workspace --workdir /workspace $(GITHUB_ACTIONS_ENV) {{ project_name }} --verbose
docker run --rm --volume $(PWD):/workspace --workdir /workspace $(GITHUB_ACTIONS_ENV) {{ project_name }} --verbose{% if uses_git %} $(FROM){% endif %}

.PHONY: publish-docker-image
publish-docker-image:
Expand Down
2 changes: 2 additions & 0 deletions rust/flake.nix → rust/flake.nix.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
pkgs.python313
pkgs.python313Packages.autopep8
pkgs.python313Packages.behave
{%- if uses_git %}
pkgs.git
{%- endif %}
# Deploying.
pkgs.gh
];
Expand Down