Skip to content

Commit 9b25024

Browse files
authored
Merge pull request #6 from maschad/mc/fix/protect-file-structure
2 parents 7a15fbb + a48c69c commit 9b25024

File tree

18 files changed

+1291
-660
lines changed

18 files changed

+1291
-660
lines changed

.githooks/pre-commit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Run cargo clippy with the specified lint settings
4+
echo "Running cargo clippy..."
5+
cargo clippy --all-targets -- -D warnings -W clippy::pedantic -W clippy::nursery -W clippy::style -W clippy::complexity -W clippy::perf -W clippy::suspicious -W clippy::correctness
6+
7+
# Check if clippy succeeded
8+
if [ $? -ne 0 ]; then
9+
echo "Clippy found issues. Commit aborted."
10+
exit 1
11+
fi
12+
13+
echo "Clippy checks passed. Proceeding with commit."
14+
exit 0

.githooks/setup-hooks.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# Set the hooks directory
4+
git config core.hooksPath .githooks
5+
6+
# Make the pre-commit hook executable
7+
chmod +x .githooks/pre-commit
8+
9+
echo "Git hooks configured successfully."

.github/workflows/format.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Rust Format
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
format:
14+
name: Format
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust toolchain
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: rustfmt, clippy
23+
24+
- name: Run clippy
25+
run: |
26+
cargo clippy \
27+
--all-targets \
28+
-- -D warnings \
29+
-W clippy::pedantic \
30+
-W clippy::nursery \
31+
-W clippy::style \
32+
-W clippy::complexity \
33+
-W clippy::perf \
34+
-W clippy::suspicious \
35+
-W clippy::correctness
36+
37+
- name: Check formatting
38+
run: cargo fmt --all -- --check

.github/workflows/homebrew.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
tag:
5+
description: "Specify tag to bump"
6+
required: true
7+
8+
name: Bump Homebrew
9+
10+
jobs:
11+
bump-homebrew:
12+
name: "Bump Homebrew"
13+
runs-on: macos-latest
14+
steps:
15+
- name: Bump Homebrew Formula
16+
uses: mislav/bump-homebrew-formula-action@v1
17+
with:
18+
formula-name: junkanoo
19+
homebrew-tap: maschad/homebrew-junkanoo
20+
tag-name: ${{ github.event.inputs.tag }}
21+
download-url: https://github.com/maschad/junkanoo/releases/download/${{ github.event.inputs.tag }}/junkanoo-${{ github.event.inputs.tag }}-x86_64-apple-darwin.tar.gz
22+
env:
23+
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}

.github/workflows/release.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
artifact_name: junkanoo-ubuntu
20+
target: x86_64-unknown-linux-gnu
21+
- os: windows-latest
22+
artifact_name: junkanoo-windows
23+
target: x86_64-pc-windows-msvc
24+
- os: macos-latest
25+
artifact_name: junkanoo-macos
26+
target: x86_64-apple-darwin
27+
- os: ubuntu-latest
28+
artifact_name: junkanoo-arch
29+
target: x86_64-unknown-linux-gnu
30+
is_arch: true
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install Rust toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
targets: ${{ matrix.target }}
39+
40+
- name: Cache dependencies
41+
uses: Swatinem/rust-cache@v2
42+
43+
- name: Build
44+
run: cargo build --release --target ${{ matrix.target }}
45+
46+
- name: Install Arch Linux dependencies
47+
if: matrix.is_arch
48+
run: |
49+
sudo pacman -Syu --noconfirm
50+
sudo pacman -S --noconfirm base-devel
51+
52+
- name: Build Arch package
53+
if: matrix.is_arch
54+
run: |
55+
makepkg -f
56+
57+
- name: Upload artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: ${{ matrix.artifact_name }}
61+
path: |
62+
target/${{ matrix.target }}/release/junkanoo*
63+
*.pkg.tar.zst
64+
if-no-files-found: error
65+
66+
create-release:
67+
name: Create Release
68+
needs: build
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Download all artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
path: artifacts
75+
76+
- name: Create Release
77+
id: create_release
78+
uses: softprops/action-gh-release@v1
79+
with:
80+
files: |
81+
artifacts/junkanoo-ubuntu/*
82+
artifacts/junkanoo-windows/*
83+
artifacts/junkanoo-macos/*
84+
artifacts/junkanoo-arch/*.pkg.tar.zst
85+
generate_release_notes: true
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Rust Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust toolchain
20+
uses: dtolnay/rust-toolchain@stable
21+
22+
- name: Cache dependencies
23+
uses: Swatinem/rust-cache@v2
24+
- name: Run tests
25+
run: cargo test --verbose

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/target
22
**/*.rs.bk
33
.env
4-
.vscode/
54
logs/

.vscode/settings.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"rust-analyzer.check.command": "clippy",
3+
"rust-analyzer.check.extraArgs": [
4+
"--",
5+
"-D",
6+
"warnings",
7+
"-W",
8+
"clippy::pedantic",
9+
"-W",
10+
"clippy::nursery",
11+
"-W",
12+
"clippy::style",
13+
"-W",
14+
"clippy::complexity",
15+
"-W",
16+
"clippy::perf",
17+
"-W",
18+
"clippy::suspicious",
19+
"-W",
20+
"clippy::correctness"
21+
],
22+
"[toml]": {
23+
"editor.defaultFormatter": "tamasfe.even-better-toml",
24+
"editor.formatOnSave": true
25+
},
26+
"evenBetterToml.formatter.alignEntries": true,
27+
"evenBetterToml.formatter.arrayTrailingComma": true,
28+
"evenBetterToml.formatter.columnWidth": 100,
29+
"evenBetterToml.formatter.indentString": " ",
30+
"evenBetterToml.formatter.reorderKeys": true
31+
}

0 commit comments

Comments
 (0)