This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (105 loc) · 3.49 KB
/
lint.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
name: lint
on:
push:
branches:
- master
- release
pull_request:
branches:
- master
- release
jobs:
build-matrix:
runs-on: ubuntu-latest
steps:
- name: Push
if: github.event_name == 'push'
run:
echo >>$GITHUB_ENV BRANCHES=[\"$(echo ${{ github.ref }}|cut -c12- )\"]
- name: Pull request
if: github.event_name == 'pull_request'
run: echo >>$GITHUB_ENV BRANCHES=[\"${{ github.ref }}\"]
- name: Schedule
if: github.event_name == 'schedule'
run: echo >>$GITHUB_ENV BRANCHES=[\"master\", \"release\"]
- name: Set matrix
id: matrix
run: echo "::set-output name=matrix::$BRANCHES"
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
clippy:
needs: build-matrix
strategy:
fail-fast: false
matrix:
branch: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Load last run details
if: github.event_name != 'pull_request'
uses: actions/cache@v3
with:
path: |
~/rustc-version.txt
~/outcome.txt
key: lint-${{ matrix.branch }}
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
components: clippy
- name: Compare rustc versions
id: rustc-version
if: github.event_name == 'schedule'
continue-on-error: true
run: "! diff -u ~/rustc-version.txt <(rustc -V)"
- name: Save new rustc version
if: github.event_name != 'pull_request'
run: rustc -V > ~/rustc-version.txt
- name: Emit last outcome if rustc version is the same
if: steps.rustc-version.outcome == 'failure'
run: diff -u ~/outcome.txt <(echo "success")
- name: Checkout
if: steps.rustc-version.outcome != 'failure'
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
submodules: recursive
- name: Install Curl
if: steps.rustc-version.outcome != 'failure'
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev
- name: Get sentry-native commit
id: sentry-native
if: steps.rustc-version.outcome != 'failure'
run:
echo "::set-output name=version::$(git submodule status | cut -d ' '
-f 2)"
- name: Cache sentry-native
if: steps.rustc-version.outcome != 'failure'
uses: actions/cache@v3
with:
path: ~/sentry-native
key:
${{ runner.os }}-${{ steps.sentry-native.outputs.version }}-true-${{
hashFiles('sentry-contrib-native-sys/build.rs') }}
- name: Set SENTRY_NATIVE_INSTALL
if: steps.rustc-version.outcome != 'failure'
run: echo >>$GITHUB_ENV SENTRY_NATIVE_INSTALL=$HOME/sentry-native
- name: Clippy
if: steps.rustc-version.outcome != 'failure'
run:
cargo clippy -v --all-targets --features transport-custom ${{
matrix.rust.feature }} -- -D warnings
- name: Documentation
if: steps.rustc-version.outcome != 'failure'
env:
RUSTDOCFLAGS: -D warnings
run:
cargo -v doc --no-deps --document-private-items --workspace --features
transport-custom
- name: Save outcome
if:
always() && steps.rustc-version.outcome != 'failure' &&
github.event_name != 'pull_request'
run: echo ${{ job.status }} > ~/outcome.txt