-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 1.73 KB
/
template-test.yml
File metadata and controls
68 lines (59 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# SPDX-FileCopyrightText: 2025 RAprogramm <andrey.rozanov.vl@gmail.com>
#
# SPDX-License-Identifier: MIT
name: Template Test
on:
push:
branches: [main]
paths:
- "**.toml"
- "**.rs"
- "**.yml"
- "**.md"
pull_request:
paths:
- "**.toml"
- "**.rs"
- "**.yml"
- "**.md"
jobs:
generate:
name: Test cargo-generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: taiki-e/install-action@v2
with:
tool: cargo-generate
- name: Generate project
run: |
cargo generate --path . \
--name test-crate \
--define gh_username=testuser \
--define author_name="Test Author" \
--define author_email="test@example.com" \
--define description="A test crate for CI" \
--destination /tmp
- name: Verify generated files
working-directory: /tmp/test-crate
run: |
echo "=== Cargo.toml ==="
cat Cargo.toml
grep -q 'name = "test-crate"' Cargo.toml
grep -q 'authors = \["Test Author <test@example.com>"\]' Cargo.toml
echo "=== README.md ==="
head -30 README.md
grep -q 'test-crate' README.md
- name: Build and test
working-directory: /tmp/test-crate
run: |
cargo +stable check --all-features --all-targets
cargo +stable clippy --all-features --all-targets -- -D warnings
cargo +stable test --all-features
cargo +nightly fmt -- --check