Skip to content

Commit 2bd95ae

Browse files
authored
chore: setup workflow (#4)
* chore: use git submodule to clone sass embedded protocol * chore: setup CI * fix ci * fix visibility
1 parent ecbaf83 commit 2bd95ae

19 files changed

+1286
-1506
lines changed

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
8+
- package-ecosystem: "gitsubmodule"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"
12+
13+
- package-ecosystem: "cargo"
14+
directory: "/"
15+
schedule:
16+
interval: "daily"
17+
18+
- package-ecosystem: "npm"
19+
directory: "/ext/sass"
20+
schedule:
21+
interval: "daily"

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['**']
7+
pull_request:
8+
9+
jobs:
10+
fmt:
11+
name: Rustfmt
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
toolchain: stable
18+
components: rustfmt
19+
profile: minimal
20+
override: true
21+
- run: cargo fmt --all -- --check
22+
23+
clippy:
24+
name: Clippy
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: arduino/setup-protoc@v1
29+
with:
30+
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
- uses: actions/setup-node@v2
32+
with:
33+
node-version: 16
34+
- run: |
35+
cd scripts
36+
npm install
37+
node setup.mjs
38+
- uses: actions-rs/toolchain@v1
39+
with:
40+
toolchain: stable
41+
components: clippy
42+
profile: minimal
43+
override: true
44+
- run: cargo clippy --all-targets --all-features -- -D warnings
45+
46+
test:
47+
name: 'Tests | ${{ matrix.os }}'
48+
runs-on: ${{ matrix.os }}-latest
49+
50+
strategy:
51+
matrix:
52+
os: [ubuntu, macos, windows]
53+
fail-fast: false
54+
55+
steps:
56+
- uses: actions/checkout@v2
57+
- uses: arduino/setup-protoc@v1
58+
with:
59+
repo-token: ${{ secrets.GITHUB_TOKEN }}
60+
- uses: actions/setup-node@v2
61+
with:
62+
node-version: 16
63+
- name: setup sass-embedded
64+
run: |
65+
cd scripts
66+
npm install
67+
node setup.mjs
68+
- uses: actions-rs/toolchain@v1
69+
with:
70+
toolchain: 'stable'
71+
profile: minimal
72+
override: true
73+
- name: test default features
74+
run: cargo test -- --nocapture
75+
- name: test legacy features
76+
run: cargo test --features legacy -- --test-threads=1 --nocapture

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@ Cargo.lock
99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
1111

12-
# Local sass
13-
/sass_embedded
14-
1512
.DS_Store
13+
node_modules

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ edition = "2021"
55
resolver = "2"
66

77
[features]
8-
legacy = ["dep:regex", "dep:serde_json"]
8+
default = []
9+
legacy = ["dep:regex", "dep:serde_json", "dep:urlencoding"]
910

1011
[dependencies]
1112
prost = "0.11"
@@ -17,6 +18,7 @@ crossbeam-channel = "0.5"
1718
rustc-hash = "1"
1819
regex = { version = "1", optional = true }
1920
serde_json = { version = "1", optional = true }
21+
urlencoding = { version = "2", optional = true }
2022

2123
[dev-dependencies]
2224
serde_json = "1"

build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use prost_build::Config;
44

55
fn main() {
66
println!("cargo:rerun-if-changed=build.rs");
7-
println!("cargo:rerun-if-changed=embedded_sass.proto");
7+
8+
println!("cargo:rerun-if-changed=ext/sass/sass-embedded.proto");
89
Config::new()
910
.out_dir("src/protocol")
10-
.compile_protos(&["embedded_sass.proto"], &["."])
11+
.compile_protos(&["ext/sass/sass-embedded.proto"], &["."])
1112
.unwrap();
13+
14+
println!("cargo:rerun-if-changed=.rustfmt.toml");
1215
Command::new("rustfmt")
1316
.arg("./src/protocol/sass.embedded_protocol.rs")
1417
.spawn()

0 commit comments

Comments
 (0)