-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chore) skeletal rust workspace, project config, IDE, CI, etc
- Loading branch information
Showing
14 changed files
with
414 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[target.'cfg(target_os="linux")'] | ||
rustflags = ["-C", "link-arg=-fuse-ld=mold"] | ||
|
||
[target.'cfg(target_os="windows")'] | ||
rustflags = ["-C", "link-arg=-fuse-ld=lld"] | ||
|
||
# On Windows MSVC, statically link the C runtime so that the resulting EXE does | ||
# not depend on the vcruntime DLL. | ||
[target.'cfg(all(windows, target_env = "msvc"))'] | ||
rustflags = ["-C", "target-feature=+crt-static"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 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/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "cargo" | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "monthly" | ||
commit-message: | ||
prefix: "chore(deps)" | ||
groups: | ||
cargo: | ||
patterns: | ||
- "*" | ||
|
||
- package-ecosystem: "github-actions" | ||
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.) | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
commit-message: | ||
prefix: "chore(ci)" | ||
include: "scope" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- main | ||
pull_request: | ||
branches: | ||
- dev | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
# Build the app on all supported platforms | ||
build: | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-22.04] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set minimal profile (Windows only) | ||
if: matrix.platform == 'windows-latest' | ||
run: rustup set profile minimal | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
key: "${{matrix.platform}}" | ||
- name: install packages (ubuntu) | ||
if: matrix.platform == 'ubuntu-22.04' | ||
run: sudo apt-get update && sudo apt-get -y --no-install-recommends install mold | ||
- name: Build | ||
run: cargo build --locked | ||
|
||
# We only need to run the checks on a single platform | ||
checks: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
key: ubuntu-22.04 | ||
- name: install packages | ||
run: sudo apt-get update && sudo apt-get -y --no-install-recommends install mold | ||
# Checks begin here! | ||
- run: cargo fmt --all -- --check | ||
- run: cargo test --locked | ||
- run: cargo clippy --locked --all-targets | ||
# We care that the benchmarks build and run, not about their numeric output. | ||
# To keep the CI a bit leaner, do this in the dev profile. | ||
- run: cargo build --locked --all-targets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: cleanup caches made by a branch | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# `actions:write` permission is required to delete caches | ||
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id | ||
actions: write | ||
contents: read | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cleanup | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO=${{ github.repository }} | ||
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*~ | ||
*.swp | ||
.temp | ||
|
||
# Added by cargo | ||
|
||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"rust-lang.rust-analyzer", | ||
"vadimcn.vscode-lldb", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"name": "Debug executable 'qcpt'", | ||
"cargo": { | ||
"args": [ | ||
"build", | ||
"--bin=qcpt", | ||
"--package=qcpt" | ||
], | ||
"filter": { | ||
"name": "qcpt", | ||
"kind": "bin" | ||
} | ||
}, | ||
"args": [], | ||
"cwd": "${workspaceFolder}" | ||
}, | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"name": "Debug unit tests in executable 'qcpt'", | ||
"cargo": { | ||
"args": [ | ||
"test", | ||
"--no-run", | ||
"--bin=qcpt", | ||
"--package=qcpt" | ||
], | ||
"filter": { | ||
"name": "qcpt", | ||
"kind": "bin" | ||
} | ||
}, | ||
"args": [], | ||
"cwd": "${workspaceFolder}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"[typescript]": { | ||
"editor.defaultFormatter": "vscode.typescript-language-features" | ||
}, | ||
"[html]": { | ||
"editor.defaultFormatter": "vscode.html-language-features" | ||
}, | ||
"[css]": { | ||
"editor.defaultFormatter": "vscode.css-language-features" | ||
}, | ||
"rust-analyzer.linkedProjects": [ | ||
"./Cargo.toml" | ||
], | ||
"rust-analyzer.showUnlinkedFileNotification": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "cargo", | ||
"command": "build", | ||
"problemMatcher": [ | ||
"$rustc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"label": "rust: cargo build" | ||
}, | ||
{ | ||
"type": "cargo", | ||
"command": "check", | ||
"problemMatcher": [ | ||
"$rustc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"label": "rust: cargo check" | ||
}, | ||
{ | ||
"type": "cargo", | ||
"command": "clippy", | ||
"problemMatcher": [ | ||
"$rustc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"label": "rust: cargo clippy" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[workspace] | ||
members = [ | ||
"qcpt" | ||
] | ||
resolver = "2" | ||
package.version = "0.1.0" | ||
package.edition = "2021" | ||
package.authors = ["Ross Younger <[email protected]>"] | ||
package.license = "AGPL-3.0-or-later" | ||
|
||
[workspace.lints.rust] | ||
dead_code = "warn" | ||
elided_lifetimes_in_paths = "deny" | ||
meta_variable_misuse = "deny" | ||
missing_abi = "deny" | ||
missing_copy_implementations = "deny" | ||
missing_debug_implementations = "deny" | ||
missing_docs = "warn" | ||
non_ascii_idents = "deny" | ||
single_use_lifetimes = "deny" | ||
trivial_casts = "deny" | ||
trivial_numeric_casts = "deny" | ||
unsafe_code = "deny" | ||
unsafe_op_in_unsafe_fn = "deny" | ||
unreachable_pub = "deny" | ||
# unused_crate_dependencies = "deny" # false positives | ||
unused_extern_crates = "deny" | ||
unused_lifetimes = "deny" | ||
unused_results = "deny" | ||
variant_size_differences = "deny" | ||
|
||
[workspace.lints.clippy] | ||
pedantic = { level = "deny", priority = -1 } | ||
missing_errors_doc = "allow" |
Oops, something went wrong.