Skip to content

Commit 67b86a8

Browse files
committed
Initial commit
0 parents  commit 67b86a8

File tree

7 files changed

+643
-0
lines changed

7 files changed

+643
-0
lines changed

.github/workflows/rust.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags:
7+
- '*'
8+
pull_request:
9+
branches: [ "main" ]
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Caching objects
23+
id: cache-objects
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo
28+
${{ github.workspace }}/target
29+
key: ${{ runner.os }}-rust-objects
30+
31+
- name: Set env RELEASE_VERSION
32+
run: |
33+
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
34+
35+
- name: pre-commit
36+
run: |
37+
pip install pre-commit
38+
pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks
39+
pre-commit run --all-files
40+
41+
- name: Build
42+
run: cargo build --verbose
43+
44+
- name: Run tests
45+
run: cargo test --verbose
46+
47+
- name: Code coverage
48+
run: |
49+
cargo install cargo-llvm-cov
50+
# rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu
51+
cargo llvm-cov
52+
53+
# - name: Install Miri
54+
# run: |
55+
# rustup toolchain install nightly --component miri
56+
# rustup override set nightly
57+
# cargo miri setup
58+
# - name: Test with Miri
59+
# run: cargo miri test
60+
61+
# Delivery
62+
- name: Install package handler
63+
if: startsWith(github.event.ref, 'refs/tags/')
64+
run: cargo install cargo-deb
65+
66+
- name: Set Cargo.toml version
67+
if: startsWith(github.event.ref, 'refs/tags/')
68+
shell: bash
69+
run: |
70+
mv Cargo.toml Cargo.toml.orig
71+
sed "s/0\\.0\\.0-git/${{env.RELEASE_VERSION}}/" Cargo.toml.orig >Cargo.toml
72+
mv Cargo.lock Cargo.lock.orig
73+
sed "s/0\\.0\\.0-git/${{env.RELEASE_VERSION}}/" Cargo.lock.orig >Cargo.lock
74+
75+
- name: Create package
76+
if: startsWith(github.event.ref, 'refs/tags/')
77+
run: cargo deb
78+
79+
- name: Publish the release
80+
if: startsWith(github.event.ref, 'refs/tags/')
81+
uses: softprops/action-gh-release@v1
82+
with:
83+
files: |
84+
${{github.workspace}}/target/debian/*.deb

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
# RustRover
13+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
14+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
15+
# and can be added to the global gitignore or merged into this file. For a more nuclear
16+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
17+
#.idea/

0 commit comments

Comments
 (0)