-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (102 loc) · 3.45 KB
/
rust-workflow.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Rust workflow
# Trigger the CI on any tags, pushes to any branch and PRs to any branch.
on:
push:
branches: [ "main" ]
tags: [ "*" ]
pull_request:
branches: [ "*" ]
env:
CARGO_TERM_COLOR: always
# Make sure there is no pipeline running uselessly.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Defined CI jobs.
jobs:
simple-checks:
container: ghcr.io/famedly/rust-container:nightly
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v3
with:
path: head
- uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main
with:
gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}}
gitlab_user: ${{ secrets.GITLAB_USER }}
gitlab_pass: ${{ secrets.GITLAB_PASS }}
- name: Caching
uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191
with:
cache-on-failure: true
cache-all-crates: true
- name: Rustfmt
shell: bash
working-directory: head
run: cargo +${NIGHTLY_VERSION} fmt -- --check
- name: Clippy
working-directory: head
shell: bash
run: cargo +${NIGHTLY_VERSION} clippy --workspace --all-targets -- -D warnings
- name: Doc-test
shell: bash
working-directory: head
run: cargo +${NIGHTLY_VERSION} test --doc --workspace --verbose
- name: Udeps
shell: bash
working-directory: head
run: cargo +${NIGHTLY_VERSION} udeps
- name: Typos
shell: bash
working-directory: head
run: typos --exclude '*.key' --exclude '*.crt' --exclude '*.csr' --exclude '*.srl'
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v3
with:
path: head
- uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main
with:
gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}}
gitlab_user: ${{ secrets.GITLAB_USER }}
gitlab_pass: ${{ secrets.GITLAB_PASS }}
- name: Add llvm-tools rust component
run: rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu
- name: Caching
uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191
with:
cache-on-failure: true
cache-all-crates: true
- name: Install additional cargo tooling
shell: bash
run: cargo install cargo-nextest cargo-llvm-cov --locked
- name: Test
timeout-minutes: 20
shell: bash
working-directory: head
run: |
docker compose --project-directory ./tests/environment down -v
cargo llvm-cov nextest --profile ci --workspace --lcov --output-path '${{github.workspace}}/lcov.info'
sed "s|$PWD/||g" -i '${{github.workspace}}/lcov.info'
- name: Get docker logs on failure
shell: bash
if: failure()
working-directory: head
run: |
docker compose --project-directory ./tests/environment logs
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470
- name: Codecov - Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
files: "${{github.workspace}}/lcov.info"
- name: Codecov - Upload test results
uses: codecov/test-results-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
file: "${{github.workspace}}/target/ci/junit.xml"