Skip to content

Commit 630e975

Browse files
committed
v2
1 parent 4e51b29 commit 630e975

15 files changed

+1643
-1069
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: ["0x7d8"]
2+
ko_fi: "rjansen"

.github/workflows/build.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: '00 01 * * *'
9+
10+
jobs:
11+
check:
12+
name: Check
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout sources
16+
uses: actions/checkout@v2
17+
18+
- name: Install stable toolchain
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
profile: minimal
22+
toolchain: stable
23+
override: true
24+
25+
- uses: Swatinem/rust-cache@v1
26+
27+
- name: Run cargo check
28+
uses: actions-rs/cargo@v1
29+
with:
30+
command: check
31+
32+
test:
33+
name: Test Suite
34+
strategy:
35+
matrix:
36+
os: [ubuntu-latest, macos-latest, windows-latest]
37+
rust: [stable]
38+
runs-on: ${{ matrix.os }}
39+
steps:
40+
- name: Checkout sources
41+
uses: actions/checkout@v2
42+
43+
- name: Install stable toolchain
44+
uses: actions-rs/toolchain@v1
45+
with:
46+
profile: minimal
47+
toolchain: ${{ matrix.rust }}
48+
override: true
49+
50+
- uses: Swatinem/rust-cache@v1
51+
52+
- name: Run cargo test
53+
uses: actions-rs/cargo@v1
54+
with:
55+
command: test
56+
57+
58+
lints:
59+
name: Lints
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout sources
63+
uses: actions/checkout@v2
64+
with:
65+
submodules: true
66+
67+
- name: Install stable toolchain
68+
uses: actions-rs/toolchain@v1
69+
with:
70+
profile: minimal
71+
toolchain: stable
72+
override: true
73+
components: rustfmt, clippy
74+
75+
- uses: Swatinem/rust-cache@v1
76+
77+
- name: Run cargo fmt
78+
uses: actions-rs/cargo@v1
79+
with:
80+
command: fmt
81+
args: --all -- --check
82+
83+
- name: Run cargo clippy
84+
uses: actions-rs/cargo@v1
85+
with:
86+
command: clippy
87+
args: -- -D warnings

.github/workflows/release.yml

+202
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
name: Release
2+
on:
3+
# schedule:
4+
# - cron: '0 0 * * *' # midnight UTC
5+
6+
push:
7+
branches:
8+
- main
9+
10+
env:
11+
BIN_NAME: draw-together
12+
PROJECT_NAME: draw-together
13+
REPO_NAME: 0x7d8/draw-together
14+
15+
jobs:
16+
dist:
17+
name: Dist
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false # don't fail other jobs if one fails
21+
matrix:
22+
build: [x86_64-linux, x86_64-macos, x86_64-windows] #, x86_64-win-gnu, win32-msvc
23+
include:
24+
- build: x86_64-linux
25+
os: ubuntu-20.04
26+
rust: stable
27+
target: x86_64-unknown-linux-gnu
28+
cross: false
29+
# - build: aarch64-linux
30+
# os: ubuntu-20.04
31+
# rust: stable
32+
# target: aarch64-unknown-linux-gnu
33+
# cross: true
34+
- build: x86_64-macos
35+
os: macos-latest
36+
rust: stable
37+
target: x86_64-apple-darwin
38+
cross: false
39+
- build: x86_64-windows
40+
os: windows-2019
41+
rust: stable
42+
target: x86_64-pc-windows-msvc
43+
cross: false
44+
# - build: aarch64-macos
45+
# os: macos-latest
46+
# rust: stable
47+
# target: aarch64-apple-darwin
48+
# - build: x86_64-win-gnu
49+
# os: windows-2019
50+
# rust: stable-x86_64-gnu
51+
# target: x86_64-pc-windows-gnu
52+
# - build: win32-msvc
53+
# os: windows-2019
54+
# rust: stable
55+
# target: i686-pc-windows-msvc
56+
57+
steps:
58+
- name: Checkout sources
59+
uses: actions/checkout@v2
60+
with:
61+
submodules: true
62+
63+
- name: Install ${{ matrix.rust }} toolchain
64+
uses: actions-rs/toolchain@v1
65+
with:
66+
profile: minimal
67+
toolchain: ${{ matrix.rust }}
68+
target: ${{ matrix.target }}
69+
override: true
70+
71+
- name: Run cargo test
72+
uses: actions-rs/cargo@v1
73+
with:
74+
use-cross: ${{ matrix.cross }}
75+
command: test
76+
args: --release --target ${{ matrix.target }}
77+
78+
- name: Build release binary
79+
uses: actions-rs/cargo@v1
80+
with:
81+
use-cross: ${{ matrix.cross }}
82+
command: build
83+
args: --release --target ${{ matrix.target }}
84+
85+
- name: Strip release binary (linux and macos)
86+
if: matrix.build == 'x86_64-linux' || matrix.build == 'x86_64-macos'
87+
run: strip "target/${{ matrix.target }}/release/$BIN_NAME"
88+
89+
# - name: Strip release binary (arm)
90+
# if: matrix.build == 'aarch64-linux'
91+
# run: |
92+
# docker run --rm -v \
93+
# "$PWD/target:/target:Z" \
94+
# rustembedded/cross:${{ matrix.target }} \
95+
# aarch64-linux-gnu-strip \
96+
# /target/${{ matrix.target }}/release/$BIN_NAME
97+
98+
- name: Build archive
99+
shell: bash
100+
run: |
101+
mkdir dist
102+
if [ "${{ matrix.os }}" = "windows-2019" ]; then
103+
cp "target/${{ matrix.target }}/release/$BIN_NAME.exe" "dist/"
104+
else
105+
cp "target/${{ matrix.target }}/release/$BIN_NAME" "dist/"
106+
fi
107+
108+
- uses: actions/upload-artifact@v4
109+
with:
110+
name: bins-${{ matrix.build }}
111+
path: dist
112+
113+
publish:
114+
name: Publish
115+
needs: [dist]
116+
runs-on: ubuntu-latest
117+
permissions:
118+
contents: write
119+
steps:
120+
- name: Checkout sources
121+
uses: actions/checkout@v2
122+
with:
123+
submodules: false
124+
125+
- uses: actions/download-artifact@v4
126+
# with:
127+
# path: dist
128+
# - run: ls -al ./dist
129+
- run: ls -al bins-*
130+
131+
- name: Build archive
132+
shell: bash
133+
run: |
134+
set -ex
135+
136+
rm -rf tmp
137+
mkdir tmp
138+
mkdir dist
139+
140+
for dir in bins-* ; do
141+
platform=${dir#"bins-"}
142+
unset exe
143+
if [[ $platform =~ "windows" ]]; then
144+
exe=".exe"
145+
fi
146+
pkgname=$PROJECT_NAME-$platform
147+
mkdir tmp/$pkgname
148+
# cp LICENSE README.md tmp/$pkgname
149+
mv bins-$platform/$BIN_NAME$exe tmp/$pkgname
150+
chmod +x tmp/$pkgname/$BIN_NAME$exe
151+
152+
if [ "$exe" = "" ]; then
153+
tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
154+
else
155+
(cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
156+
fi
157+
done
158+
159+
- name: Get cli version from Cargo.toml
160+
id: version
161+
run: echo "val=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' -r)" >> $GITHUB_OUTPUT
162+
163+
- name: Upload binaries to release
164+
uses: svenstaro/upload-release-action@v2
165+
with:
166+
repo_token: ${{ secrets.GITHUB_TOKEN }}
167+
file: dist/*
168+
file_glob: true
169+
tag: ${{ steps.version.outputs.val }}
170+
overwrite: true
171+
172+
#
173+
# you can use this initial file in your homebrew-tap if you don't have an initial formula:
174+
# <projectname>.rb
175+
#
176+
# class <Projectname capitalized> < Formula
177+
# desc "A test formula"
178+
# homepage "http://www.example.com"
179+
# url "-----"
180+
# version "-----"
181+
# sha256 "-----"
182+
183+
# def install
184+
# bin.install "<bin-name>"
185+
# end
186+
# end
187+
188+
189+
# Uncomment this section if you want to release your package to crates.io
190+
# Before publishing, make sure you have filled out the following fields:
191+
# license or license-file, description, homepage, documentation, repository, readme.
192+
# Read more: https://doc.rust-lang.org/cargo/reference/publishing.html
193+
194+
# - name: Install ${{ matrix.rust }} toolchain
195+
# uses: actions-rs/toolchain@v1
196+
# with:
197+
# profile: minimal
198+
# toolchain: ${{ matrix.rust }}
199+
# target: ${{ matrix.target }}
200+
# - run: cargo publish --token ${CRATES_TOKEN}
201+
# env:
202+
# CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}

.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
lib/
2-
node_modules/
3-
history.raw
1+
/target
2+
history_2.raw

0 commit comments

Comments
 (0)