Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TornaxO7 authored Nov 23, 2024
0 parents commit 43463f3
Show file tree
Hide file tree
Showing 11 changed files with 516 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

permissions:
contents: write

# Use our Nix Flake Environment for steps
defaults:
run:
shell: nix develop --command bash {0}

on:
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]

env:
CARGO_TERM_COLOR: always

jobs:
formatting:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: TornaxO7/rust-template@v1-ci-actions
- name: Check formatting
if: github.event.pull_request.head.repo.full_name != github.repository
run: cargo fmt --check --verbose
- name: Format code
id: format_code
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
cargo fmt --verbose
echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
- name: Committing reformatted code
if: |
steps.format_code.outputs.modified == 'true' &&
github.event.pull_request.head.repo.full_name == github.repository
run: |
git config --global user.name 'Github Actions'
git config --global user.email '<>'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated formatting"
git push
check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: TornaxO7/rust-template@v1-ci-actions
- name: Check for build errors
run: cargo check --verbose

clippy:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: TornaxO7/rust-template@v1-ci-actions
- name: Check best practices (Clippy)
run: cargo clippy --verbose -- -Dwarnings

tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: TornaxO7/rust-template@v1-ci-actions
- name: Running tests
run: cargo test --verbose
24 changes: 24 additions & 0 deletions .github/workflows/flake-lock-updater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: update-flake-lock
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- uses: TornaxO7/rust-template@v1-ci-actions
- name: Update flake.lock
id: update-flake-lock
run: nix flake update
- name: Commit updated flake.lock
if: |
steps.update-flake-lock.outputs.modified == 'true' &&
github.event.pull_request.head.repo.full_name == github.repository
run: |
git config --global user.name 'Github Actions'
git config --global user.email '<>'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated formatting"
git push
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

.direnv/
Loading

0 comments on commit 43463f3

Please # to comment.