Skip to content

Commit

Permalink
Merge pull request #1 from r0gue-io/daan/feat-assets
Browse files Browse the repository at this point in the history
feat: pop drink
  • Loading branch information
Daanvdplas authored Oct 18, 2024
2 parents 77db6b2 + daf9162 commit 13ea823
Show file tree
Hide file tree
Showing 155 changed files with 9,256 additions and 6,617 deletions.
23 changes: 23 additions & 0 deletions .githooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Git Hooks

A pre-push hook which checks formatting of Rust files. Additional checks may be added in the future.

# Prerequisites

The following prerequisites are required:

## Rust Nightly

The nightly version of Rust provides additional formatting benefits over the stable version.

```shell
rustup toolchain install nightly --profile minimal --component rustfmt
```

# Installation

Use the following command in the root directory of the local repository to configure Git to use the hooks:

```shell
git config core.hooksPath .githooks
```
21 changes: 21 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -eu

# Are deps installed
if ! command -v cargo > /dev/null 2>&1
then
echo "cargo couldn't be found, please confirm your set up is properly configured."
exit 1
else
# Check Rust formatting
if ! cargo +nightly fmt --all -- --check
then
echo "There are some code style issues."
# shellcheck disable=SC2006
echo "Run 'cargo +nightly fmt --all' first."
exit 1
fi
fi

exit 0
32 changes: 32 additions & 0 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Initialize
description: This action initializes a runner for use in other actions.
inputs:
cache-key:
description: "The key to be used for the cache"

runs:
using: "composite"
steps:
- name: Setup Ubuntu dependencies
shell: bash
run: sudo apt update && sudo apt install -y protobuf-compiler

- name: Free up space on runner
shell: bash
run: |
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Rust Cache
uses: Swatinem/[email protected]
with:
cache-on-failure: true
cache-all-crates: true
key: ${{ inputs.cache-key }}
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: ci

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

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Check formatting
run: |
rustup toolchain install nightly --profile minimal --component rustfmt
cargo +nightly fmt --all -- --check
check:
needs: lint
runs-on: ubuntu-latest
env:
SKIP_WASM_BUILD: 1
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Check Build
run: |
cargo check --release --locked
clippy:
needs: lint
runs-on: ubuntu-latest
permissions:
checks: write
env:
RUSTFLAGS: "-Wmissing_docs"
SKIP_WASM_BUILD: 1
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Annotate with Clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --release --locked
20 changes: 20 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
lint:
name: Validate PR title for conventional commit compliance
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/publish.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/rust-checks.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Non-default formatting configuration options: use with `cargo +nightly fmt --all`
binop_separator = "Back"
chain_width = 80
combine_control_expr = false
comment_width = 100
condense_wildcard_suffixes = true
edition = "2021"
format_code_in_doc_comments = true
format_strings = true
group_imports = "StdExternalCrate"
hard_tabs = true
imports_granularity = "Crate"
match_arm_blocks = false
match_block_trailing_comma = true
newline_style = "Unix"
normalize_comments = true
reorder_impl_items = true
trailing_semicolon = false
unstable_features = true
use_field_init_shorthand = true
# Uses max_width or its default value (100) if not specified.
use_small_heuristics = "Max"
use_try_shorthand = true
wrap_comments = true
Loading

0 comments on commit 13ea823

Please sign in to comment.