Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Aug 15, 2024
0 parents commit 46cbdb9
Show file tree
Hide file tree
Showing 18 changed files with 3,730 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci"

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(crates)"
30 changes: 30 additions & 0 deletions .github/workflows/autobot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Auto-merge Dependabot"

on: "pull_request"

jobs:
automerge:
name: "Check and merge PR"

if: ${{ github.actor == 'dependabot[bot]' }}

runs-on: "ubuntu-latest"

permissions:
contents: "write"
pull-requests: "write"

steps:
- name: "Fetch metadata"
uses: "dependabot/fetch-metadata@v2"
id: "metadata"
with:
github-token: ${{ github.token }}

- name: "Enable auto-merge"
if: ${{ contains(fromJSON('["version-update:semver-patch", "version-update:semver-minor"]'), steps.metadata.outputs.update-type) }}
run: |
gh pr merge --auto --squash "$PR"
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.html_url }}
131 changes: 131 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: "CI"

on:
push:
branches: ["main"]
paths:
- "**.rs"
- "Cargo.toml"
pull_request:
paths:
- "**.rs"
- "Cargo.toml"
workflow_dispatch:

jobs:
msrv:
name: "Read MSRV"
uses: "actions-rust-lang/msrv/.github/workflows/msrv.yml@v0"

build:
name: "Build"
needs: ["msrv"]

strategy:
fail-fast: false
matrix:
rust-version:
# Latest nightly
- "nightly"
# Latest stable
- "stable"
# MSRV
- ${{ needs.msrv.outputs.msrv }}

runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Install Rust"
uses: "actions-rust-lang/setup-rust-toolchain@v1"
with:
toolchain: ${{ matrix.rust-version }}

- name: "Run build"
run: |
cargo build
documentation:
name: "Documentation"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Install Rust"
uses: "actions-rust-lang/setup-rust-toolchain@v1"

- name: "Generate docs"
env:
RUSTDOCFLAGS: "-Dwarnings"
run: |
cargo rustdoc
rustfmt:
name: "Rustfmt"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: "actions/checkout@v4"

- name: "Install Rust"
uses: "actions-rust-lang/setup-rust-toolchain@v1"
with:
components: "rustfmt"

- name: "Run rustfmt"
uses: "actions-rust-lang/rustfmt@v1"

test:
name: "Test"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: "actions/checkout@v4"

- name: "Install Rust"
uses: "actions-rust-lang/setup-rust-toolchain@v1"
with:
components: "rustfmt"

- name: "Run tests"
run: |
cargo test
typos:
name: "Typos"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout repository"
uses: "actions/checkout@v4"

- name: "Check for typos"
uses: "crate-ci/typos@v1"

release-gate:
name: "CI Release gate"
needs:
- "build"
- "documentation"
- "rustfmt"
- "test"
- "typos"

if: ${{ always() }}

runs-on: "ubuntu-latest"

steps:
- name: "Exit with error"
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
52 changes: 52 additions & 0 deletions .github/workflows/clippy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Clippy"

on:
push:
branches: ["main"]
paths:
- "**.rs"
- "Cargo.toml"
- "Cargo.lock"
pull_request:
paths:
- "**.rs"
- "Cargo.toml"
- "Cargo.lock"
workflow_dispatch:

jobs:
clippy:
name: "Run scan"

runs-on: "ubuntu-latest"

permissions:
security-events: "write"

steps:
- name: "Checkout repository"
uses: "actions/checkout@v4"

- name: "Install Rust"
uses: "actions-rust-lang/setup-rust-toolchain@v1"
with:
components: "clippy"

- name: "Install sarif tools"
run: |
cargo install clippy-sarif sarif-fmt
- name: "Run clippy"
run: |
cargo clippy \
--all-features \
--all-targets \
--tests \
--message-format=json \
| clippy-sarif | tee /tmp/clippy-result | sarif-fmt
- name: "Upload results"
uses: "github/codeql-action/upload-sarif@v3"
with:
sarif_file: "/tmp/clippy-result"
wait-for-processing: true
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
### https://raw.github.com/github/gitignore/Rust.gitignore

# 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

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### https://raw.github.com/github/gitignore/Global/Windows.gitignore

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk


### https://raw.github.com/github/gitignore/Global/Linux.gitignore

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*


### https://raw.github.com/github/gitignore/Global/macOS.gitignore

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
Expand Down
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hard_tabs = true
45 changes: 45 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "modrinth-api"
version = "0.1.0"
authors = [
"Seth <getchoo at tuta dot io>",
"SkywardMC Contributors"
]
edition = "2021"
rust-version = "1.78"
description = "Structured bindings for Modrinth's API"
readme = "README.md"
repository = "https://github.com/skywardmc/modrinth-api"
license = "MPL-2.0"
keywords = ["minecraft", "modrinth", "api", "binding"]
categories = ["api-bindings"]
exclude = [
"/.github",
"/.gitignore",
"**.nix",
"flake.lock"
]

# TODO: publish :)
publish = false

[dependencies]
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
serde_json = "1.0"

[lints.clippy]
cargo = "warn"
complexity = "warn"
correctness = "deny"
pedantic = "warn"
perf = "warn"
style = "warn"
suspicious = "deny"

[lints.rust]
unsafe_code = "forbid"

[package.metadata.typos]
files.extend-exclude = ["tests/**"]
Loading

0 comments on commit 46cbdb9

Please sign in to comment.