Skip to content

Commit

Permalink
Init project (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenserblack committed Aug 9, 2023
1 parent e201e89 commit b624ae2
Show file tree
Hide file tree
Showing 47 changed files with 2,624 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Rust",
"image": "mcr.microsoft.com/devcontainers/rust:1",
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"rebornix.ruby",
"rust-lang.rust-analyzer"
],
"settings": {
"editor.formatOnSave": true,
"files.autoSaveDelay": 1000
}
}
},
"postCreateCommand": ".devcontainer/postCreate.sh",
"remoteUser": "vscode"
}
3 changes: 3 additions & 0 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cargo install cargo-insta
cargo build
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
root = true

[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
indent_style = space
indent_size = 2

[*.rb]
indent_style = space
indent_size = 2

[*.rs]
indent_style = space
indent_size = 4

[*.sh]
indent_style = tab
indent_size = 8

[*.toml]
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 2
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.snap -whitespace linguist-language=Text
/gengo/languages.yaml linguist-detectable

# For tests
dist/* gengo-detectable gengo-language=Plain-Text
2 changes: 2 additions & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
output-type: lcov
output-file: ./lcov.info
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Check
run: cargo check

- name: Build
run: cargo build --verbose

- name: Test
run: cargo test --verbose

- name: Install tarpaulin
uses: actions-rs/install@v0.1
# NOTE: The last step fails if tarpaulin is already installed
continue-on-error: true
with:
crate: cargo-tarpaulin
- name: Generate Coverage
run: cargo tarpaulin --verbose --workspace --timeout 120 --out Xml
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.os }}
token: ${{ secrets.CODECOV_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check Format
run: cargo fmt -- --check

- name: Lint
run: cargo clippy -- -D warnings

check-languages-file:
name: Check Languages File
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Check Languages File
run: ruby ./scripts/check-languages-file.rb
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
# will have compiled files and executables
/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

# Generated by tarpaulin
cobertura.xml

# Temporary snapshot files generated by insta
*.snap.new
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"rebornix.ruby",
"rust-lang.rust-analyzer"
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
}
Loading

0 comments on commit b624ae2

Please sign in to comment.