Skip to content

Commit d143612

Browse files
authored
Merge pull request rust-lang-ja#29 from qryxip/ja-all-enabled-add-a-tool-to-test-rustc-dep-option-generator
Add a tool to test `rustc-dep-option-generator`
2 parents 457a84d + e518f26 commit d143612

File tree

21 files changed

+373
-11
lines changed

21 files changed

+373
-11
lines changed

.cargo/config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[alias]
2-
dep-tests = ["run", "--manifest-path", "./dep-tests/Cargo.toml", "--"]
2+
dep-tests = ["run", "--manifest-path", "./tools/dep-tests/Cargo.toml", "--"]
3+
test-with-generated-opts = ["run", "--manifest-path", "./tools/test-with-generated-opts/Cargo.toml", "--"]

.github/workflows/ci.yml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,55 @@ jobs:
3737
command: fmt
3838
args: -- --check
3939

40-
- name: '`cargo fmt --manifest-path ./dep-tests/Cargo.toml -- --check`'
40+
- name: '`cargo fmt --manifest-path ./tools/dep-tests/Cargo.toml -- --check`'
4141
uses: actions-rs/cargo@v1
4242
with:
4343
command: fmt
44-
args: --manifest-path ./dep-tests/Cargo.toml -- --check
44+
args: --manifest-path ./tools/dep-tests/Cargo.toml -- --check
45+
46+
- name: '`cargo fmt --manifest-path ./tools/test-with-generated-opts/Cargo.toml -- --check`'
47+
uses: actions-rs/cargo@v1
48+
with:
49+
command: fmt
50+
args: --manifest-path ./tools/test-with-generated-opts/Cargo.toml -- --check
51+
52+
test-with-generated-opts:
53+
name: test-with-generated-opts
54+
runs-on: ubuntu-18.04
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v1
59+
60+
- name: rust-toolchain
61+
uses: actions-rs/toolchain@v1
62+
with:
63+
toolchain: 1.38.0-x86_64-unknown-linux-gnu
64+
default: true
65+
profile: default
66+
67+
- name: '`cargo install --git https://github.com/rust-lang-ja/atcoder-rustc-dep-option-generator`'
68+
uses: actions-rs/cargo@v1
69+
with:
70+
command: install
71+
args: --git https://github.com/rust-lang-ja/atcoder-rustc-dep-option-generator
72+
73+
- name: '`cargo clippy --all-features --manifest-path ./tools/test-with-generated-opts/Cargo.toml -- -D warnings`'
74+
uses: actions-rs/cargo@v1
75+
with:
76+
command: clippy
77+
args: --all-features --manifest-path ./tools/test-with-generated-opts/Cargo.toml -- -D warnings
78+
79+
- name: '`cargo build --all-features --release`'
80+
uses: actions-rs/cargo@v1
81+
with:
82+
command: build
83+
args: --all-features --release
84+
85+
- name: '`cargo test-with-generated-opts`'
86+
uses: actions-rs/cargo@v1
87+
with:
88+
command: test-with-generated-opts
4589

4690
build:
4791
strategy:
@@ -147,18 +191,18 @@ jobs:
147191
command: run
148192
args: ${{ matrix.features }} --release
149193

150-
- name: '`cargo clippy ${{ matrix.features }} --manifest-path ./dep-tests/Cargo.toml -- -D warnings`'
194+
- name: '`cargo clippy ${{ matrix.features }} --manifest-path ./tools/dep-tests/Cargo.toml -- -D warnings`'
151195
uses: actions-rs/cargo@v1
152196
with:
153197
command: clippy
154-
args: ${{ matrix.features }} --manifest-path ./dep-tests/Cargo.toml -- -D warnings
198+
args: ${{ matrix.features }} --manifest-path ./tools/dep-tests/Cargo.toml -- -D warnings
155199
if: matrix.dep_tests
156200

157-
- name: '`cargo test ${{ matrix.features }} --manifest-path ./dep-tests/Cargo.toml --no-fail-fast`'
201+
- name: '`cargo test ${{ matrix.features }} --manifest-path ./tools/dep-tests/Cargo.toml --no-fail-fast`'
158202
uses: actions-rs/cargo@v1
159203
with:
160204
command: test
161-
args: ${{ matrix.features }} --manifest-path ./dep-tests/Cargo.toml --no-fail-fast
205+
args: ${{ matrix.features }} --manifest-path ./tools/dep-tests/Cargo.toml --no-fail-fast
162206
if: matrix.dep_tests
163207

164208
- name: '`cargo dep-tests --all-features -d 1`'

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/target/
2-
/dep-tests/Cargo.lock
3-
/dep-tests/target/
1+
/tools/dep-tests/Cargo.lock
2+
/tools/test-with-generated-opts/Cargo.lock
3+
**/target/
44
**/*.rs.bk
55
**/*~

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "0.1.0"
66
edition = "2018"
77

88
[workspace]
9-
exclude = ["./dep-tests"]
9+
exclude = ["./tools"]
1010

1111
[[bin]]
1212
name = "main"

examples/arc065-c.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// https://atcoder.jp/contests/arc065/tasks/arc065_a
2+
3+
use lazy_static::lazy_static;
4+
use proconio::input;
5+
use proconio::marker::Bytes;
6+
use regex::bytes::Regex;
7+
8+
fn main() {
9+
input! {
10+
s: Bytes,
11+
}
12+
13+
lazy_static! {
14+
static ref R: Regex = Regex::new(r"\A(dream(er)?|eraser?)*\z").unwrap();
15+
};
16+
println!("{}", if R.is_match(&s) { "YES" } else { "NO" });
17+
}

examples/practice-a.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// https://atcoder.jp/contests/practice/tasks/practice_1
2+
3+
use proconio::input;
4+
5+
fn main() {
6+
input! {
7+
a: u32,
8+
b: u32,
9+
c: u32,
10+
s: String,
11+
}
12+
13+
println!("{} {}", a + b + c, s);
14+
}

examples/tests.ron

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(
2+
tests: {
3+
"practice-a": (
4+
name: "practice contest: A - Welcome to AtCoder",
5+
word_match: Exact,
6+
),
7+
"arc065-c": (
8+
name: "ABC049 / ARC065: C - 白昼夢 / Daydream",
9+
word_match: Exact,
10+
),
11+
}
12+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
erasedream
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dreameraser
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dreamerer
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
YES
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
YES
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NO
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1
2+
2 3
3+
test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
72
2+
128 256
3+
myonmyon
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6 test
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
456 myonmyon
File renamed without changes.
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "test-with-generated-opts"
3+
version = "0.0.0"
4+
edition = "2018"
5+
publish = false
6+
description = "Test with `rustc-dep-option-generator`."
7+
8+
[dependencies]
9+
anyhow = "1.0.25"
10+
env_logger = "0.7.1"
11+
indexmap = { version = "1.3.0", features = ["serde-1"] }
12+
itertools = "0.8.2"
13+
log = "0.4.8"
14+
ron = "0.5.1"
15+
serde = { version = "1.0.103", features = ["derive"] }
16+
serde_json = "1.0.42"
17+
shell-escape = "0.1.4"
18+
structopt = "0.3.5"
19+
tempdir = "0.3.7"
20+
which = { version = "3.1.0", default-features = false }

0 commit comments

Comments
 (0)