Skip to content

Commit 15ce607

Browse files
committed
feat: initial commit for pvm
0 parents  commit 15ce607

27 files changed

Lines changed: 5773 additions & 0 deletions

.github/workflows/release.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
tests:
13+
name: Lint & Test
14+
runs-on: ubuntu-latest
15+
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Rust toolchain
21+
uses: dtolnay/rust-toolchain@stable
22+
with:
23+
components: clippy, rustfmt
24+
25+
- name: Cache Rust dependencies
26+
uses: Swatinem/rust-cache@v2
27+
28+
- name: Check format
29+
run: cargo fmt -- --check
30+
31+
- name: Lint with Clippy
32+
run: cargo clippy -- -D warnings
33+
34+
- name: Run Tests
35+
run: cargo test
36+
37+
build:
38+
name: Build / ${{ matrix.os }}
39+
needs: tests
40+
runs-on: ${{ matrix.os }}
41+
if: github.ref == 'refs/heads/main'
42+
strategy:
43+
matrix:
44+
include:
45+
- os: ubuntu-latest
46+
target: x86_64-unknown-linux-gnu
47+
artifact_name: pvm
48+
asset_name: pvm-linux-x86_64
49+
- os: macos-latest
50+
target: aarch64-apple-darwin
51+
artifact_name: pvm
52+
asset_name: pvm-macos-aarch64
53+
- os: macos-13
54+
target: x86_64-apple-darwin
55+
artifact_name: pvm
56+
asset_name: pvm-macos-x86_64
57+
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
62+
- name: Install Rust toolchain
63+
uses: dtolnay/rust-toolchain@stable
64+
with:
65+
targets: ${{ matrix.target }}
66+
67+
- name: Cache Rust dependencies
68+
uses: Swatinem/rust-cache@v2
69+
with:
70+
key: ${{ matrix.target }}
71+
72+
- name: Build release binary
73+
run: cargo build --release --target ${{ matrix.target }}
74+
75+
- name: Create tar.gz archive
76+
shell: bash
77+
run: tar -C target/${{ matrix.target }}/release -czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
78+
79+
- name: Upload artifact
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: ${{ matrix.asset_name }}
83+
path: ${{ matrix.asset_name }}.tar.gz
84+
retention-days: 1
85+
86+
release:
87+
name: Semantic Release
88+
needs: build
89+
runs-on: ubuntu-latest
90+
if: github.ref == 'refs/heads/main'
91+
permissions:
92+
contents: write
93+
issues: write
94+
pull-requests: write
95+
steps:
96+
- name: Checkout repository
97+
uses: actions/checkout@v4
98+
with:
99+
fetch-depth: 0
100+
persist-credentials: false
101+
102+
- name: Download all artifacts
103+
uses: actions/download-artifact@v4
104+
with:
105+
path: artifacts/
106+
107+
- name: Move artifacts to root
108+
run: |
109+
find artifacts -name "*.tar.gz" -exec mv {} . \;
110+
ls -la *.tar.gz
111+
112+
- name: Semantic Release
113+
id: semantic
114+
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
115+
with:
116+
tag_format: v${version}
117+
branches: |
118+
['main']
119+
extra_plugins: |
120+
@semantic-release/commit-analyzer
121+
@semantic-release/release-notes-generator
122+
@semantic-release/github
123+
@semantic-release/changelog
124+
@semantic-release/git
125+
@semantic-release/exec
126+
conventional-changelog-conventionalcommits
127+
env:
128+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.gitignore

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/linux,rust,rust-analyzer,jetbrains+all
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,rust,rust-analyzer,jetbrains+all
3+
4+
### JetBrains+all ###
5+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
6+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
7+
8+
# User-specific stuff
9+
.idea/**/workspace.xml
10+
.idea/**/tasks.xml
11+
.idea/**/usage.statistics.xml
12+
.idea/**/dictionaries
13+
.idea/**/shelf
14+
15+
# AWS User-specific
16+
.idea/**/aws.xml
17+
18+
# Generated files
19+
.idea/**/contentModel.xml
20+
21+
# Sensitive or high-churn files
22+
.idea/**/dataSources/
23+
.idea/**/dataSources.ids
24+
.idea/**/dataSources.local.xml
25+
.idea/**/sqlDataSources.xml
26+
.idea/**/dynamic.xml
27+
.idea/**/uiDesigner.xml
28+
.idea/**/dbnavigator.xml
29+
30+
# Gradle
31+
.idea/**/gradle.xml
32+
.idea/**/libraries
33+
34+
# Gradle and Maven with auto-import
35+
# When using Gradle or Maven with auto-import, you should exclude module files,
36+
# since they will be recreated, and may cause churn. Uncomment if using
37+
# auto-import.
38+
# .idea/artifacts
39+
# .idea/compiler.xml
40+
# .idea/jarRepositories.xml
41+
# .idea/modules.xml
42+
# .idea/*.iml
43+
# .idea/modules
44+
# *.iml
45+
# *.ipr
46+
47+
# CMake
48+
cmake-build-*/
49+
50+
# Mongo Explorer plugin
51+
.idea/**/mongoSettings.xml
52+
53+
# File-based project format
54+
*.iws
55+
56+
# IntelliJ
57+
out/
58+
59+
# mpeltonen/sbt-idea plugin
60+
.idea_modules/
61+
62+
# JIRA plugin
63+
atlassian-ide-plugin.xml
64+
65+
# Cursive Clojure plugin
66+
.idea/replstate.xml
67+
68+
# SonarLint plugin
69+
.idea/sonarlint/
70+
71+
# Crashlytics plugin (for Android Studio and IntelliJ)
72+
com_crashlytics_export_strings.xml
73+
crashlytics.properties
74+
crashlytics-build.properties
75+
fabric.properties
76+
77+
# Editor-based Rest Client
78+
.idea/httpRequests
79+
80+
# Android studio 3.1+ serialized cache file
81+
.idea/caches/build_file_checksums.ser
82+
83+
### JetBrains+all Patch ###
84+
# Ignore everything but code style settings and run configurations
85+
# that are supposed to be shared within teams.
86+
87+
.idea/*
88+
89+
!.idea/codeStyles
90+
!.idea/runConfigurations
91+
92+
### Linux ###
93+
*~
94+
95+
# temporary files which can be created if a process still has a handle open of a deleted file
96+
.fuse_hidden*
97+
98+
# KDE directory preferences
99+
.directory
100+
101+
# Linux trash folder which might appear on any partition or disk
102+
.Trash-*
103+
104+
# .nfs files are created when an open file is removed but is still being accessed
105+
.nfs*
106+
107+
### Rust ###
108+
# Generated by Cargo
109+
# will have compiled files and executables
110+
debug/
111+
target/
112+
113+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
114+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
115+
# Cargo.lock (Commented out because this is a binary)
116+
117+
# These are backup files generated by rustfmt
118+
**/*.rs.bk
119+
120+
# MSVC Windows builds of rustc generate these, which store debugging information
121+
*.pdb
122+
123+
### rust-analyzer ###
124+
# Can be generated by other build systems other than cargo (ex: bazelbuild/rust_rules)
125+
rust-project.json
126+
127+
128+
# End of https://www.toptal.com/developers/gitignore/api/linux,rust,rust-analyzer,jetbrains+all

.releaserc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"tagFormat": "v${version}",
3+
"branches": [
4+
"main"
5+
],
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"preset": "conventionalcommits"
11+
}
12+
],
13+
[
14+
"@semantic-release/release-notes-generator",
15+
{
16+
"preset": "conventionalcommits"
17+
}
18+
],
19+
"@semantic-release/changelog",
20+
[
21+
"@semantic-release/exec",
22+
{
23+
"prepareCmd": "sed -i 's/^version = \".*\"/version = \"${nextRelease.version}\"/' Cargo.toml && cargo build --release",
24+
"publishCmd": "cargo publish"
25+
}
26+
],
27+
[
28+
"@semantic-release/github",
29+
{
30+
"assets": [
31+
{
32+
"path": "pvm-*-linux-x86_64.tar.gz",
33+
"label": "Linux x86_64"
34+
},
35+
{
36+
"path": "pvm-*-macos-x86_64.tar.gz",
37+
"label": "macOS x86_64"
38+
},
39+
{
40+
"path": "pvm-*-macos-aarch64.tar.gz",
41+
"label": "macOS Apple Silicon"
42+
}
43+
]
44+
}
45+
],
46+
[
47+
"@semantic-release/git",
48+
{
49+
"assets": [
50+
"Cargo.toml",
51+
"Cargo.lock",
52+
"CHANGELOG.md"
53+
],
54+
"message": "chore(release): version ${nextRelease.version} \n\n${nextRelease.notes}"
55+
}
56+
]
57+
]
58+
}

0 commit comments

Comments
 (0)