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
6 changes: 6 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changes here will be overwritten by Copier
_commit: v1.7.2
_src_path: https://github.com/DeveloperC286/template
project_name: monkey_interpreter
project_type: rust
uses_git: false
3 changes: 3 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"config:best-practices"
],
"automerge": true,
"github-actions": {
"enabled": false
},
"nix": {
"enabled": true,
"lockFileMaintenance": {
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ permissions:
contents: read

jobs:
permissions:
name: Permissions
runs-on: ${{ matrix.architecture }}
strategy:
matrix:
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
language: [shell]
steps:
- name: Checkout code.
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Check permissions.
run: make check-${{ matrix.language }}-permissions

formatting:
name: Formatting
runs-on: ${{ matrix.architecture }}
Expand Down Expand Up @@ -36,17 +49,20 @@ jobs:
- name: Check linting.
run: nix develop -c make check-${{ matrix.language }}-linting

scripts-permissions:
name: Scripts Permissions
dependencies:
name: Dependencies
runs-on: ${{ matrix.architecture }}
strategy:
matrix:
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
language: [rust]
steps:
- name: Checkout code.
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Check scripts permissions.
run: make check-scripts-permissions
- name: Setup Nix.
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
- name: Check dependencies.
run: nix develop -c make check-${{ matrix.language }}-dependencies

compile:
name: Compile
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Conventional Commits

on: pull_request
on:
pull_request:
types: [opened, edited, synchronize, reopened]

permissions:
contents: read
Expand All @@ -10,12 +12,15 @@ jobs:
name: Linting
runs-on: ubuntu-24.04
container:
image: ghcr.io/developerc286/conventional_commits_linter:0.17.0@sha256:d6fb0dfd79c2e06897692bc3f0dc62bcb7ce90a92030c81a3137935516d525d7
image: ghcr.io/developerc286/conventional_commits_linter:0.17.1@sha256:f1b947937ee884ba7f886d04939cd4858f9aeafb50dcf94925a516c50e43021b
steps:
- name: Checkout code.
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check Conventional Commits linting.
run: conventional_commits_linter --type angular "origin/${{ github.base_ref }}"
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: printf '%s\n\n%s' "$PR_TITLE" "$PR_BODY" | conventional_commits_linter -
2 changes: 1 addition & 1 deletion .github/workflows/git-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Clean
runs-on: ubuntu-24.04
container:
image: ghcr.io/developerc286/clean_git_history:1.1.5@sha256:b1374591d48393f6b5fcc888f6bc7da05f7d218961f7850112130b1cad78186a
image: ghcr.io/developerc286/clean_git_history:1.1.6@sha256:93fd9c692f6e629956921b8d068ccad33760882b6e0c6d4d32cd963380aec25f
steps:
- name: Checkout code.
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
Expand Down
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Rust .gitignore
# Generated by Cargo
debug/
target/
debug
target

# Generated by rustfmt
**/*.rs.bk

# Generated by proptest
proptest-regressions/

# Generated by IntelliJ IDEA
.idea/
proptest-regressions

# Generated by direnv & Nix.
.direnv/
.direnv
35 changes: 21 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
# Auto-detect musl target for static binaries (Linux only)
# Only set MUSL_TARGET on supported architectures; targets that need it will check
MUSL_TARGET := $(shell uname -m | sed 's/^x86_64$$/x86_64-unknown-linux-musl/;s/^aarch64$$/aarch64-unknown-linux-musl/')
ifeq ($(filter %unknown-linux-musl,$(MUSL_TARGET)),)
$(error Unsupported architecture: $(shell uname -m). Static musl builds only supported on Linux x86_64 and aarch64)
endif

define check-musl-target
$(if $(filter %unknown-linux-musl,$(MUSL_TARGET)),,$(error Unsupported architecture: $(shell uname -m). Static musl builds only supported on Linux x86_64 and aarch64))
endef

# Use --locked in CI to ensure reproducible builds
CARGO_LOCKED := $(if $(CI),--locked,)

.PHONY: default
default: compile

.PHONY: check-shell-permissions
check-shell-permissions:
./ci/check-scripts-permissions.sh

.PHONY: check-rust-formatting
check-rust-formatting:
cargo fmt --all -- --check --config=group_imports=StdExternalCrate

.PHONY: check-shell-formatting
check-shell-formatting:
shfmt --simplify --diff ci/*

.PHONY: check-yaml-formatting
check-yaml-formatting:
yamlfmt -verbose -lint -dstar .github/workflows/*

.PHONY: fix-rust-formatting
fix-rust-formatting:
cargo fmt --all -- --config=group_imports=StdExternalCrate

.PHONY: check-shell-formatting
check-shell-formatting:
shfmt --simplify --diff ci/*

.PHONY: fix-shell-formatting
fix-shell-formatting:
shfmt --simplify --write ci/*

.PHONY: check-yaml-formatting
check-yaml-formatting:
yamlfmt -verbose -lint -dstar .github/workflows/*

.PHONY: fix-yaml-formatting
fix-yaml-formatting:
yamlfmt -verbose -dstar .github/workflows/*
Expand All @@ -46,9 +52,9 @@ check-shell-linting:
check-github-actions-workflows-linting:
actionlint -verbose -color

.PHONY: check-scripts-permissions
check-scripts-permissions:
./ci/check-scripts-permissions.sh
.PHONY: check-rust-dependencies
check-rust-dependencies:
cargo machete

.PHONY: compile
compile:
Expand All @@ -60,6 +66,7 @@ unit-test:

.PHONY: release
release:
$(call check-musl-target)
cargo build --release --target=$(MUSL_TARGET) --locked --verbose

.PHONY: publish-binary
Expand Down
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
pkgs.shellcheck
# GitHub Actions workflows linting.
pkgs.actionlint
# Rust dependencies check.
pkgs.cargo-machete
# Deploying.
pkgs.gh
];
Expand Down