chore: migrate to Forgejo
All checks were successful
Build and test / Clippy (pull_request) Successful in 49s
Build and test / Generate Documentation (pull_request) Successful in 45s
Build and test / Build AMD64 (pull_request) Successful in 50s
Checking yaml / Run yamllint (pull_request) Successful in 5s
Checking Renovate configuration / validate (pull_request) Successful in 1m30s
Build and test / Tests (pull_request) Successful in 2m34s

This commit is contained in:
Marc Plano-Lesay 2025-11-05 17:30:07 +11:00
parent e1271461a3
commit 5bf38fdac3
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
10 changed files with 223 additions and 97 deletions

5
.envrc
View file

@ -1,4 +1,5 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then if ! has nix_direnv_version || ! nix_direnv_version 3.0.7; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.7/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi fi
watch_file nix/**
use flake . use flake .

View file

@ -0,0 +1,24 @@
---
name: Checking Renovate configuration
on: # yamllint disable-line rule:truthy
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache npm (renovate)
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-renovate
restore-keys: |
${{ runner.os }}-npm-renovate-
- name: Validate Renovate configuration
uses: suzuki-shunsuke/github-action-renovate-config-validator@v1.1.1
env:
NPM_CONFIG_CACHE: ~/.npm
...

127
.forgejo/workflows/rust.yml Normal file
View file

@ -0,0 +1,127 @@
---
# yamllint disable rule:line-length
name: Build and test
on: # yamllint disable-line rule:truthy
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Rust toolchain
uses: actions/cache@v4
with:
path: ~/.rustup
key: ${{ runner.os }}-rustup-toolchain-stable-clippy-rustfmt
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
with:
toolchain: stable
components: clippy, rustfmt
- name: Show versions
run: |
rustc --version
cargo --version
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Rust toolchain
uses: actions/cache@v4
with:
path: ~/.rustup
key: ${{ runner.os }}-rustup-toolchain-stable-clippy-rustfmt
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
with:
toolchain: stable
components: clippy, rustfmt
- name: Show versions
run: |
rustc --version
cargo --version
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
build-amd64:
name: Build AMD64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Rust toolchain
uses: actions/cache@v4
with:
path: ~/.rustup
key: ${{ runner.os }}-rustup-toolchain-stable-clippy-rustfmt
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
with:
toolchain: stable
components: clippy, rustfmt
- name: Show versions
run: |
rustc --version
cargo --version
- name: Build release binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- name: Upload binary artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: reddit-magnet-linux-amd64
path: target/release/reddit-magnet
rustdoc:
name: Generate Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Rust toolchain
uses: actions/cache@v4
with:
path: ~/.rustup
key: ${{ runner.os }}-rustup-toolchain-stable-clippy-rustfmt
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
with:
toolchain: stable
components: clippy, rustfmt
- name: Show versions
run: |
rustc --version
cargo --version
- name: Generate documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features --workspace --no-deps
- name: Compress documentation
run: tar -czf rustdoc.tar.gz -C target doc
- name: Upload documentation artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: rustdoc
path: rustdoc.tar.gz
...

View file

@ -0,0 +1,18 @@
---
name: Checking yaml
on: # yamllint disable-line rule:truthy
pull_request:
jobs:
yamllint:
name: Run yamllint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run YAML linter
uses: bewuethr/yamllint-action@v1
with:
config-file: .yamllint.yaml
...

View file

@ -1,84 +0,0 @@
---
stages:
- test
- build
- publish
default:
tests:
stage: test
image: rust
before_script:
- rustc --version
- cargo --version
- rustup component add rustfmt
script:
- cargo fmt --check
- cargo test
flake-check:
stage: test
image: nixpkgs/nix-flakes:nixos-24.11-x86_64-linux
before_script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- chmod 400 "$NIX_SSH_PRIVATE_KEY"
- ssh-add "$NIX_SSH_PRIVATE_KEY"
- cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- echo "substituters = ssh://nix-ssh@build.enoent.fr?priority=10 https://cache.nixos.org?priority=40 https://cuda-maintainers.cachix.org https://nix-community.cachix.org https://statix.cachix.org https://pre-commit-hooks.cachix.org" >> /etc/nix/nix.conf
- echo "trusted-substituters = ssh://nix-ssh@build.enoent.fr" >> /etc/nix/nix.conf
- echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= statix.cachix.org-1:Z9E/g1YjCjU117QOOt07OjhljCoRZddiAm4VVESvais= pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" >> /etc/nix/nix.conf
- echo "extra-trusted-public-keys = galatea-0:E7F1FzfoY+X9l9Xn9AvNWDkW1U7H644FHDzX3lpxHkI=" >> /etc/nix/nix.conf
- echo "builders-use-substitutes = true" >> /etc/nix/nix.conf
- echo "max-jobs = 0" >> /etc/nix/nix.conf
- echo "ssh://nix-ssh@build.enoent.fr x86_64-linux" >> /etc/nix/machines
- echo "ssh://nix-ssh@build.enoent.fr aarch64-linux" >> /etc/nix/machines
- nix store info --store ssh://nix-ssh@build.enoent.fr
script:
- nix flake check
build:amd64:
stage: build
image: rust
before_script:
- rustc --version
- cargo --version
script:
- cargo build --release
artifacts:
paths:
- target/release/reddit-magnet
rustdoc:
stage: build
image: rust
before_script:
- rustc --version
- cargo --version
script:
- cargo doc
artifacts:
paths:
- target/doc
pages:
stage: publish
image: alpine
dependencies:
- build:amd64
- rustdoc
script:
- mkdir -p public
- mv target/doc public/doc
- mv target/release/reddit-magnet public/reddit-magnet-amd64
artifacts:
paths:
- public
only:
- main
...

30
.yamllint.yaml Normal file
View file

@ -0,0 +1,30 @@
---
ignore: |
.platformio
secrets.yaml
rules:
braces: enable
brackets: enable
colons: enable
commas: enable
comments: enable
comments-indentation: enable
document-end: enable
document-start: enable
empty-lines:
max: 1
empty-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length:
max: 100
new-line-at-end-of-file: enable
new-lines: enable
octal-values: enable
quoted-strings: disable
trailing-spaces: enable
truthy: enable
...

18
flake.lock generated
View file

@ -3,11 +3,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1747046372,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -57,11 +57,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1747744144, "lastModified": 1761373498,
"narHash": "sha256-W7lqHp0qZiENCDwUZ5EX/lNhxjMdNapFnbErcbnP11Q=", "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2795c506fe8fb7b03c36ccb51f75b6df0ab2553f", "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -80,11 +80,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1747372754, "lastModified": 1760663237,
"narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", "narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", "rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -33,7 +33,7 @@
in in
{ {
checks = import ./nix/git-hooks.nix { inherit inputs pkgs; }; checks = import ./nix/git-hooks.nix { inherit inputs pkgs; };
devShells = import ./nix/shell.nix { inherit pkgs rust-toolchain self; }; devShells = import ./nix/shell.nix { inherit pkgs rust-toolchain self; inherit (pkgs) lib; };
formatter = pkgs.nixpkgs-fmt; formatter = pkgs.nixpkgs-fmt;
}); });
} }

View file

@ -1,4 +1,4 @@
{ pkgs, rust-toolchain, self, ... }: { lib, pkgs, rust-toolchain, self, ... }:
{ {
default = pkgs.mkShell { default = pkgs.mkShell {
@ -18,10 +18,13 @@
rust-toolchain rust-toolchain
sqlfluff sqlfluff
sqlite sqlite
sccache
] ++ lib.optionals stdenv.isDarwin [ ] ++ lib.optionals stdenv.isDarwin [
libiconv libiconv
] ++ self.checks.${pkgs.system}.pre-commit-check.enabledPackages; ] ++ self.checks.${pkgs.system}.pre-commit-check.enabledPackages;
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
RUSTC_WRAPPER = lib.getExe pkgs.sccache;
# Copy rust-toolchain to project directory for easy use in IntelliJ # Copy rust-toolchain to project directory for easy use in IntelliJ
shellHook = '' shellHook = ''

7
renovate.json Normal file
View file

@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"assignees": ["kernald"],
"extends": [
"config:recommended"
]
}