|
1 | | -name: Rust CI/CD Pipeline |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
| 5 | + branches: |
| 6 | + - main |
5 | 7 | pull_request: |
6 | | - types: [opened, reopened] |
7 | 8 |
|
8 | | -env: |
9 | | - RUST_BACKTRACE: 1 |
| 9 | +permissions: |
| 10 | + pull-requests: write |
10 | 11 |
|
11 | 12 | jobs: |
12 | | - # Job 1: Format Check |
13 | | - format: |
14 | | - name: Format Check |
| 13 | + pipeline: |
15 | 14 | runs-on: ubuntu-latest |
16 | 15 | steps: |
17 | | - - name: Checkout code |
18 | | - uses: actions/checkout@v6 |
19 | | - |
20 | | - - name: Install Rust toolchain |
21 | | - uses: dtolnay/rust-toolchain@stable |
| 16 | + - uses: Taucher2003/GitLab-Pipeline-Action@1.14.4 |
| 17 | + name: Run pipeline |
| 18 | + id: pipeline |
22 | 19 | with: |
23 | | - components: rustfmt |
24 | | - |
25 | | - - name: Check formatting |
26 | | - run: cargo fmt --all -- --check |
27 | | - |
28 | | - # Job 2: Lint Check |
29 | | - lint: |
30 | | - name: Lint Check |
31 | | - runs-on: ubuntu-latest |
32 | | - steps: |
33 | | - - name: Checkout code |
34 | | - uses: actions/checkout@v6 |
35 | | - |
36 | | - - name: Install Rust toolchain |
37 | | - uses: dtolnay/rust-toolchain@stable |
| 20 | + GL_SERVER_URL: https://gitlab.com |
| 21 | + GL_PROJECT_ID: '81430101' |
| 22 | + GL_RUNNER_TOKEN: ${{ secrets.GL_RUNNER_TOKEN }} |
| 23 | + GL_API_TOKEN: ${{ secrets.GL_API_TOKEN }} |
| 24 | + SHOW_JOB_LOGS: all |
| 25 | + OVERRIDE_GITHUB_SHA: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} |
| 26 | + OVERRIDE_GITHUB_REF_NAME: ${{ github.event_name == 'push' && github.ref_name || github.event.pull_request.head.ref }} |
| 27 | + env: |
| 28 | + GLPA_C0_GH_REF: ${{ github.ref }} |
| 29 | + GLPA_C0_GH_REF_NAME: ${{ github.ref_name }} |
| 30 | + |
| 31 | + - name: Find existing comment |
| 32 | + uses: peter-evans/find-comment@v4 |
| 33 | + id: find-comment |
| 34 | + if: ${{ !cancelled() && github.event_name == 'pull_request' }} |
38 | 35 | with: |
39 | | - components: clippy |
| 36 | + issue-number: ${{ github.event.pull_request.number }} |
| 37 | + comment-author: 'github-actions[bot]' |
| 38 | + body-includes: <!-- glpa_comment:pipeline --> |
40 | 39 |
|
41 | | - - name: Cache cargo registry |
42 | | - uses: actions/cache@v5 |
| 40 | + - name: Create or update comment |
| 41 | + uses: peter-evans/create-or-update-comment@v5 |
| 42 | + if: ${{ !cancelled() && github.event_name == 'pull_request' }} |
43 | 43 | with: |
44 | | - path: | |
45 | | - ~/.cargo/registry |
46 | | - ~/.cargo/git |
47 | | - target |
48 | | - key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} |
49 | | - restore-keys: | |
50 | | - ${{ runner.os }}-cargo- |
51 | | -
|
52 | | - - name: Run clippy |
53 | | - run: cargo clippy --all-targets --all-features |
54 | | - |
55 | | - # Job 3: Build |
56 | | - build: |
57 | | - name: Build |
58 | | - needs: [ lint, format ] |
59 | | - runs-on: ubuntu-latest |
60 | | - steps: |
61 | | - - name: Checkout code |
62 | | - uses: actions/checkout@v6 |
63 | | - |
64 | | - - name: Install Rust toolchain |
65 | | - uses: dtolnay/rust-toolchain@stable |
66 | | - |
67 | | - - name: Cache cargo registry |
68 | | - uses: actions/cache@v5 |
69 | | - with: |
70 | | - path: | |
71 | | - ~/.cargo/registry |
72 | | - ~/.cargo/git |
73 | | - target |
74 | | - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} |
75 | | - restore-keys: | |
76 | | - ${{ runner.os }}-cargo- |
77 | | -
|
78 | | - - name: Build project |
79 | | - run: cargo build --verbose --all-features |
80 | | - |
81 | | - test: |
82 | | - name: Test |
83 | | - needs: build |
84 | | - runs-on: ubuntu-latest |
85 | | - steps: |
86 | | - - name: Checkout code |
87 | | - uses: actions/checkout@v6 |
88 | | - |
89 | | - - name: Install Rust toolchain |
90 | | - uses: dtolnay/rust-toolchain@stable |
91 | | - |
92 | | - - name: Cache cargo registry |
93 | | - uses: actions/cache@v5 |
94 | | - with: |
95 | | - path: | |
96 | | - ~/.cargo/registry |
97 | | - ~/.cargo/git |
98 | | - target |
99 | | - key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} |
100 | | - restore-keys: | |
101 | | - ${{ runner.os }}-cargo- |
102 | | -
|
103 | | - - name: Run Tests |
104 | | - run: cargo test --verbose --all-features |
| 44 | + comment-id: ${{ steps.find-comment.outputs.comment-id }} |
| 45 | + issue-number: ${{ github.event.pull_request.number }} |
| 46 | + body: | |
| 47 | + <!-- glpa_comment:pipeline --> |
| 48 | + ${{ steps.pipeline.outputs.SUMMARY_TEXT }} |
| 49 | + edit-mode: replace |
0 commit comments