Skip to content

Commit 3d3fd01

Browse files
committed
first commit
0 parents  commit 3d3fd01

File tree

13 files changed

+352
-0
lines changed

13 files changed

+352
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Please see the documentation for all configuration options:
2+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "cargo"
7+
directory: "/"
8+
target-branch: main
9+
schedule:
10+
interval: "daily"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and test
2+
on:
3+
pull_request:
4+
branches: [main]
5+
workflow_dispatch:
6+
jobs:
7+
build_and_test:
8+
name: Build and test
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
env: [ubuntu-64, macos-64, windows-64]
13+
include:
14+
- env: ubuntu-64
15+
os: ubuntu-latest
16+
toolchain: stable-x86_64-unknown-linux-gnu
17+
- env: macos-64
18+
os: macos-latest
19+
toolchain: stable-x86_64-apple-darwin
20+
- env: windows-64
21+
os: windows-latest
22+
toolchain: stable-x86_64-pc-windows-msvc
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
- name: Setup Rust toolchain ${{ matrix.toolchain }} for ${{ matrix.os }}
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: ${{ matrix.toolchain }}
30+
override: true
31+
- name: Setup Cargo cache
32+
uses: Swatinem/rust-cache@v2
33+
- name: Test using ${{ matrix.toolchain }} for ${{ matrix.os }}
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: test
37+
args: --release --all-features
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish pre-release
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
github:
7+
name: Publish GitHub
8+
permissions:
9+
contents: write
10+
environment: GITHUB_PRE_RELEASE
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable-x86_64-unknown-linux-gnu
19+
override: true
20+
- name: Setup Cargo cache
21+
uses: Swatinem/rust-cache@v2
22+
- name: Package
23+
uses: actions-rs/cargo@v1
24+
with:
25+
command: package
26+
args: --all-features
27+
- name: Read crate name
28+
id: crate_name
29+
run: echo "crate_name=$(cargo read-manifest | jq -r .name)" >> $GITHUB_OUTPUT
30+
- name: Read version
31+
id: version
32+
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
33+
- name: Read git commit hash
34+
id: commit_hash
35+
run: echo "commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
36+
- name: Create release
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions
39+
run: gh release create "${{ steps.commit_hash.outputs.commit_hash }}" --repo="$GITHUB_REPOSITORY" --target main --title="Pre-Release ${{ steps.commit_hash.outputs.commit_hash }} (${{ steps.version.outputs.version }})" --generate-notes --prerelease "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Publish release
2+
on:
3+
push:
4+
branches: [release/**]
5+
jobs:
6+
check_version_bump:
7+
name: Check version bump
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
13+
uses: actions-rs/toolchain@v1
14+
with:
15+
toolchain: stable-x86_64-unknown-linux-gnu
16+
override: true
17+
- name: Read source branch version
18+
id: source_version
19+
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
20+
- name: Update cargo index
21+
run: cargo search
22+
- name: Read crates.io version
23+
id: crates_io_version
24+
run: echo "version=$(cargo search --limit 1 $(cargo read-manifest | jq -r .name) | grep -oP '(?<=")([0-9]+.[0-9]+.[0-9]+)(?=")')" >> $GITHUB_OUTPUT
25+
- name: Parse and compare versions
26+
run: |
27+
source_version="${{ steps.source_version.outputs.version }}"
28+
crates_io_version="${{ steps.crates_io_version.outputs.version }}"
29+
if [ "$(printf '%s\n' "$crates_io_version" "$source_version" | sort -V | head -n1)" != "$source_version" ]; then
30+
echo "Source branch version ($source_version) is higher than crates.io version ($crates_io_version)."
31+
else
32+
echo "Source branch version ($source_version) is not higher than crates.io version ($crates_io_version)."
33+
exit 1
34+
fi
35+
crates_io:
36+
name: Publish crates.io
37+
needs: check_version_bump
38+
environment: CRATES_IO
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
44+
uses: actions-rs/toolchain@v1
45+
with:
46+
toolchain: stable-x86_64-unknown-linux-gnu
47+
override: true
48+
- name: Setup Cargo cache
49+
uses: Swatinem/rust-cache@v2
50+
- name: Login to crates.io
51+
uses: actions-rs/cargo@v1
52+
with:
53+
command: login
54+
args: ${{ secrets.CRATES_IO_TOKEN }}
55+
- name: Publish to crates.io
56+
uses: actions-rs/cargo@v1
57+
with:
58+
command: publish
59+
github:
60+
name: Publish GitHub
61+
needs: crates_io
62+
permissions:
63+
contents: write
64+
environment: GITHUB_RELEASE
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v2
69+
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
70+
uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: stable-x86_64-unknown-linux-gnu
73+
override: true
74+
- name: Setup Cargo cache
75+
uses: Swatinem/rust-cache@v2
76+
- name: Package
77+
uses: actions-rs/cargo@v1
78+
with:
79+
command: package
80+
args: --all-features
81+
- name: Read crate name
82+
id: crate_name
83+
run: echo "crate_name=$(cargo read-manifest | jq -r .name)" >> $GITHUB_OUTPUT
84+
- name: Read version
85+
id: version
86+
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
87+
- name: Create release
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions
90+
run: gh release create "${{ steps.version.outputs.version }}" --repo="$GITHUB_REPOSITORY" --title="Release ${{ steps.version.outputs.version }}" --generate-notes --latest "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate"

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug/
4+
target/
5+
6+
# These are backup files generated by rustfmt
7+
**/*.rs.bk
8+
9+
# MSVC Windows builds of rustc generate these, which store debugging information
10+
*.pdb
11+
12+
13+
# Added by cargo
14+
15+
/target

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"nixEnvSelector.nixFile": "${workspaceFolder}/shell.nix"
3+
}

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "template"
3+
version = "0.1.0"
4+
authors = ["<name>"]
5+
edition = "2021"
6+
rust-version = "1.82.0"
7+
description = "<description>"
8+
readme = "README.md"
9+
repository = "<repository>"
10+
license = "MIT"
11+
keywords = ["<keywords>", "<keywords>"]
12+
exclude = [".devcontainer", ".github", ".vscode"]
13+
14+
[profile.release]
15+
debug = false
16+
opt-level = 3
17+
lto = true
18+
19+
[profile.dev]
20+
debug = true
21+
opt-level = 0
22+
lto = false
23+
24+
[dependencies]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) <year> <name>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<p align="center">
2+
<img src="image" width="512">
3+
</p>
4+
5+
# Project
6+
7+
Project description
8+
9+
## Collaborating
10+
11+
Check out [Milestones](milestone), [Board](project), and [Issues](issues)
12+
13+
## TODO
14+
15+
1. Manually run "Build and test" GitHub Action
16+
2. Adapt repo settings (See manual steps below)
17+
3. Adapt README.md
18+
4. Adapt LICENSE
19+
5. Adapt Cargo.toml: Name, Author, Description, Repository, Keywords
20+
21+
## Manual steps
22+
23+
- Turn off Wikis
24+
- Only allow squash merging (Pull request title and commit details)
25+
- Always suggest updating pull request branches
26+
- Allow auto-merge
27+
- Automatically delete head branches
28+
- Include Git LFS objects in archives
29+
- Rulesets:
30+
- Default branch:
31+
- Enforce: Active
32+
- Bypass: Organization Admin, Repo Admin, Maintain Role, Dependabot
33+
- Target: Default branch
34+
- Restrict deletions
35+
- Require linear history
36+
- Require signed commits
37+
- Require pull request before merging
38+
- Required approvals: 1
39+
- Dismiss stale pull request approvals when new commits are pushed
40+
- Require conversation resolution before merging
41+
- Request pull request review from Copilot
42+
- Require status checks to pass:
43+
- Require branches to be up to date before merging
44+
- Do not require status checks on creation
45+
- Build and test (ubuntu)
46+
- Build and test (windows)
47+
- Build and test (macos)
48+
- Block force push
49+
- Release branches:
50+
- Enforce: Active
51+
- Target: release/\*\*
52+
- Restrict updates
53+
- Restrict deletions
54+
- Require linear history
55+
- Require signed commits
56+
- Require pull request before merging
57+
- Required approvals: 1
58+
- Dismiss stale pull request approvals when new commits are pushed
59+
- Require conversation resolution before merging
60+
- Request pull request review from Copilot
61+
- Require status checks to pass:
62+
- Require branches to be up to date before merging
63+
- Do not require status checks on creation
64+
- Build and test (ubuntu)
65+
- Build and test (windows)
66+
- Build and test (macos)
67+
- Block force push
68+
- Environments: (Can be ignored, will be automatically created by CI/CD jobs)
69+
- CRATES_IO
70+
- GITHUB_RELEASE
71+
- GITHUB_PRE_RELEASE

0 commit comments

Comments
 (0)