Skip to content

Commit 4125f2c

Browse files
committed
init
0 parents  commit 4125f2c

File tree

20 files changed

+3427
-0
lines changed

20 files changed

+3427
-0
lines changed

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dotenv_if_exists
2+
use nix

.github/workflows/build.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
test:
16+
name: test on ${{ matrix.os }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v6.0.1
25+
- name: install Rust toolchain
26+
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
27+
- name: run tests
28+
run: cargo test --verbose
29+
- name: build
30+
run: cargo build --verbose
31+
- name: build release
32+
run: cargo build --release --verbose
33+
34+
format:
35+
name: check formatting
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: checkout
39+
uses: actions/checkout@v6.0.1
40+
- name: install rust toolchain
41+
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
42+
with:
43+
components: rustfmt
44+
- name: check formatting
45+
run: cargo fmt -- --check
46+
47+
clippy:
48+
name: run clippy
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: checkout
52+
uses: actions/checkout@v6.0.1
53+
- name: install rust toolchain
54+
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
55+
with:
56+
components: clippy
57+
- name: run clippy
58+
run: cargo clippy -- -D warnings

.github/workflows/release.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
name: build ${{ matrix.target }} on ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-gnu
21+
artifact_name: carat
22+
artifact_suffix: linux-amd64
23+
- os: ubuntu-latest
24+
target: aarch64-unknown-linux-gnu
25+
artifact_name: carat
26+
artifact_suffix: linux-aarch64
27+
- os: macos-latest
28+
target: aarch64-apple-darwin
29+
artifact_name: carat
30+
artifact_suffix: macos-aarch64
31+
- os: windows-latest
32+
target: x86_64-pc-windows-msvc
33+
artifact_name: carat.exe
34+
artifact_suffix: windows-amd64
35+
36+
steps:
37+
- name: checkout
38+
uses: actions/checkout@v6.0.1
39+
40+
- name: install rust toolchain
41+
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
42+
with:
43+
target: ${{ matrix.target }}
44+
45+
- name: install cross-compilation tools (Linux ARM)
46+
if: matrix.target == 'aarch64-unknown-linux-gnu'
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y gcc-aarch64-linux-gnu
50+
51+
- name: build
52+
run: cargo build --release --target ${{ matrix.target }}
53+
env:
54+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
55+
56+
- name: prepare artifact
57+
shell: bash
58+
run: |
59+
cd target/${{ matrix.target }}/release
60+
if [ "${{ runner.os }}" = "Windows" ]; then
61+
7z a ../../../carat-${{ matrix.artifact_suffix }}.zip ${{ matrix.artifact_name }}
62+
else
63+
tar czf ../../../carat-${{ matrix.artifact_suffix }}.tar.gz ${{ matrix.artifact_name }}
64+
fi
65+
66+
- name: upload artifact
67+
uses: actions/upload-artifact@v6
68+
with:
69+
name: carat-${{ matrix.artifact_suffix }}
70+
path: carat-${{ matrix.artifact_suffix }}.*
71+
72+
release:
73+
name: publish release
74+
needs: build
75+
runs-on: ubuntu-latest
76+
permissions:
77+
contents: write
78+
steps:
79+
- name: download artifacts
80+
uses: actions/download-artifact@v6
81+
with:
82+
path: artifacts
83+
84+
- name: flatten files
85+
run: |
86+
mkdir release-files
87+
find artifacts -type f -name 'carat-*' -exec mv {} release-files/ \;
88+
89+
- name: upload to release
90+
uses: softprops/action-gh-release@v2
91+
with:
92+
files: release-files/*
93+
tag_name: ${{ github.ref_name }}
94+
make_latest: true
95+
generate_release_notes: true

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.db
2+
.direnv
3+
result*
4+
tmp
5+
nixcache.log
6+
7+
# rust
8+
debug/
9+
target/
10+
**/*.rs.bk
11+
*.pdb
12+
13+
.env
14+
*.db
15+
*.db-journal
16+
*.db-shm
17+
*.db-wal
18+
# Nuxt dev/build outputs
19+
.output
20+
.data
21+
.nuxt
22+
.nitro
23+
.cache
24+
dist
25+
26+
# Node dependencies
27+
node_modules
28+
node_modules/
29+
docs/.vitepress/dist
30+
docs/.vitepress/cache
31+
32+
# Logs
33+
logs
34+
*.log
35+
npm-debug.log*
36+
yarn-debug.log*
37+
yarn-error.log*
38+
pnpm-debug.log*
39+
lerna-debug.log*
40+
41+
# Editor directories and files
42+
.vscode/*
43+
!.vscode/extensions.json
44+
.idea
45+
.DS_Store
46+
*.suo
47+
*.ntvs*
48+
*.njsproj
49+
*.sln
50+
*.sw?
51+
52+
# Environment variables
53+
.env
54+
.env.*
55+
!.env.example

0 commit comments

Comments
 (0)