Skip to content

Commit 3ef94a9

Browse files
committed
init
0 parents  commit 3ef94a9

34 files changed

Lines changed: 14029 additions & 0 deletions

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.wasm32-unknown-unknown]
2+
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
name: Build (${{ matrix.os }})
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
- macos-latest
17+
- windows-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
22+
- name: Setup Rust
23+
uses: dtolnay/rust-toolchain@v1
24+
with:
25+
toolchain: stable
26+
27+
- name: Cache cargo
28+
uses: Swatinem/rust-cache@v2
29+
with:
30+
shared-key: ${{ matrix.os }}
31+
32+
- name: Install Linux dependencies
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y \
37+
pkg-config \
38+
libx11-dev \
39+
libxkbcommon-dev \
40+
libwayland-dev \
41+
libxcb1-dev \
42+
libxrandr-dev \
43+
libxcursor-dev \
44+
libxi-dev \
45+
libxinerama-dev \
46+
libgl1-mesa-dev \
47+
libegl1-mesa-dev \
48+
libxcb-shape0-dev \
49+
libxcb-xfixes0-dev
50+
51+
- name: Check
52+
run: cargo check

.github/workflows/release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build (${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: linux-x86_64
21+
- os: macos-latest
22+
target: macos-aarch64
23+
- os: windows-latest
24+
target: windows-x86_64
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v5
28+
29+
- name: Setup Rust
30+
uses: dtolnay/rust-toolchain@v1
31+
with:
32+
toolchain: stable
33+
34+
- name: Cache cargo
35+
uses: Swatinem/rust-cache@v2
36+
with:
37+
shared-key: release-${{ matrix.os }}
38+
39+
- name: Install Linux dependencies
40+
if: matrix.os == 'ubuntu-latest'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y \
44+
pkg-config \
45+
zip \
46+
libx11-dev \
47+
libxkbcommon-dev \
48+
libwayland-dev \
49+
libxcb1-dev \
50+
libxrandr-dev \
51+
libxcursor-dev \
52+
libxi-dev \
53+
libxinerama-dev \
54+
libgl1-mesa-dev \
55+
libegl1-mesa-dev \
56+
libxcb-shape0-dev \
57+
libxcb-xfixes0-dev
58+
59+
- name: Build
60+
run: cargo build --release
61+
62+
- name: Package (Linux)
63+
if: matrix.os == 'ubuntu-latest'
64+
run: |
65+
VERSION="${{ github.ref_name }}"
66+
ARCHIVE="curve-fit-${VERSION}-${{ matrix.target }}.zip"
67+
rm -f "$ARCHIVE"
68+
if [ -f README.md ]; then
69+
zip -j "$ARCHIVE" target/release/curve-fit README.md
70+
else
71+
zip -j "$ARCHIVE" target/release/curve-fit
72+
fi
73+
74+
- name: Package (Windows)
75+
if: matrix.os == 'windows-latest'
76+
shell: pwsh
77+
run: |
78+
$version = "${{ github.ref_name }}"
79+
$archive = "curve-fit-$version-${{ matrix.target }}.zip"
80+
if (Test-Path $archive) { Remove-Item $archive }
81+
$files = @("target/release/curve-fit.exe")
82+
if (Test-Path "README.md") { $files += "README.md" }
83+
Compress-Archive -Path $files -DestinationPath $archive -Force
84+
85+
- name: Package (macOS)
86+
if: matrix.os == 'macos-latest'
87+
run: |
88+
VERSION="${{ github.ref_name }}"
89+
ARCHIVE="curve-fit-${VERSION}-${{ matrix.target }}.zip"
90+
rm -f "$ARCHIVE"
91+
if [ -f README.md ]; then
92+
zip -j "$ARCHIVE" target/release/curve-fit README.md
93+
else
94+
zip -j "$ARCHIVE" target/release/curve-fit
95+
fi
96+
97+
- name: Upload artifact
98+
uses: actions/upload-artifact@v6
99+
with:
100+
name: curve-fit-${{ github.ref_name }}-${{ matrix.target }}
101+
path: curve-fit-${{ github.ref_name }}-${{ matrix.target }}.zip
102+
103+
release:
104+
name: Publish Release
105+
runs-on: ubuntu-latest
106+
needs: build
107+
steps:
108+
- name: Download artifacts
109+
uses: actions/download-artifact@v8
110+
with:
111+
path: dist
112+
pattern: curve-fit-*
113+
merge-multiple: true
114+
115+
- name: Publish GitHub Release
116+
env:
117+
GH_TOKEN: ${{ github.token }}
118+
TAG_NAME: ${{ github.ref_name }}
119+
run: |
120+
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
121+
gh release upload "$TAG_NAME" dist/*.zip --clobber
122+
else
123+
gh release create "$TAG_NAME" dist/*.zip --title "$TAG_NAME" --generate-notes
124+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)