Skip to content

Commit 85bfbf4

Browse files
authored
add test-case for unit (#1)
* add test-case for `unit` * rustfmt 2021
1 parent 1927205 commit 85bfbf4

File tree

7 files changed

+840
-0
lines changed

7 files changed

+840
-0
lines changed

.github/workflows/ci.yml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: ci
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: ${{ matrix.kind }} ${{ matrix.os }} ${{ matrix.rust }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os:
12+
- macOS-latest
13+
- ubuntu-latest
14+
- windows-latest
15+
rust:
16+
# - stable
17+
# - beta
18+
- nightly
19+
20+
env:
21+
CARGO_INCREMENTAL: 0
22+
RUST_BACKTRACE: full
23+
CARGO_TERM_COLOR: always
24+
25+
steps:
26+
- name: Clone repository
27+
uses: actions/checkout@v2
28+
29+
- name: Install rust (${{ matrix.rust }}) toolchain
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: ${{ matrix.rust }}
33+
profile: minimal
34+
override: true
35+
components: rustfmt, clippy
36+
37+
- name: Log versions
38+
run: |
39+
rustc --version
40+
cargo --version
41+
42+
- name: Configure cargo data directory
43+
# After this point, all cargo registry and crate data is stored in
44+
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
45+
# that are needed during the build process. Additionally, this works
46+
# around a bug in the 'cache' action that causes directories outside of
47+
# the workspace dir to be saved/restored incorrectly.
48+
run: |
49+
echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
50+
51+
- name: Cache
52+
uses: actions/cache@v2
53+
with:
54+
# Note: crates from the denoland/deno git repo always get rebuilt,
55+
# and their outputs ('deno', 'libdeno.rlib' etc.) are quite big,
56+
# so we cache only those subdirectories of target/{debug|release} that
57+
# contain the build output for crates that come from the registry.
58+
path: |-
59+
.cargo_home
60+
target/*/.*
61+
target/*/build
62+
target/*/deps
63+
key:
64+
${{ matrix.config.os }}-${{ matrix.config.rust }}-${{ hashFiles('Cargo.lock') }}
65+
restore-keys: |
66+
${{ matrix.config.os }}-${{ matrix.config.rust }}
67+
68+
- name: Run cargo fmt
69+
run: cargo fmt --all -- --check
70+
71+
- name: Run cargo check
72+
run: cargo check --locked
73+
74+
- name: Run cargo clippy
75+
run: cargo clippy -- -D warnings
76+
77+
- name: Build release
78+
run: cargo build --release --locked
79+
80+
- name: Run cargo test
81+
run: cargo test --locked
82+
83+
- name: Publish
84+
if: |
85+
startsWith(matrix.os, 'ubuntu') &&
86+
startsWith(github.repository, 'postcss-rs') &&
87+
startsWith(github.ref, 'refs/tags/')
88+
env:
89+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
90+
run: |
91+
cargo publish

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/target
2+
/.cargo_home
3+
*.log
4+
.idea
5+
node_modules
6+
.DS_Store
7+
.tmp

.rustfmt.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
max_width = 100
2+
tab_spaces = 2
3+
edition = "2021"

0 commit comments

Comments
 (0)