This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
Deprecation #271
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |