This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
Deprecation #643
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- release | |
pull_request: | |
branches: | |
- master | |
- release | |
defaults: | |
run: | |
shell: bash | |
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 }} | |
cargo-audit: | |
needs: build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
branch: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust | |
uses: hecrj/setup-rust-action@v1 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/.crates.toml | |
~/.cargo/.crates2.json | |
~/.cargo/bin/cargo-audit | |
key: cargo-audit | |
- name: Install cargo-audit | |
run: cargo -v install cargo-audit | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ matrix.branch }} | |
- name: Audit | |
run: cargo audit -D warnings | |
ci: | |
needs: build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
feature: | |
- { | |
name: "--no-default-features --features transport-custom", | |
transport-default: false, | |
transport-custom: true, | |
} | |
- { name: "", transport-default: true, transport-custom: false } | |
os: | |
- { | |
runner: ubuntu-latest, | |
target: x86_64-unknown-linux-gnu, | |
test: true, | |
} | |
- { runner: macos-latest, target: x86_64-apple-darwin, test: true } | |
- { | |
runner: macos-latest, | |
target: aarch64-apple-darwin, | |
test: false, | |
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk, | |
} | |
- { | |
runner: windows-latest, | |
target: x86_64-pc-windows-msvc, | |
test: true, | |
} | |
branch: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
runs-on: ${{ matrix.os.runner }} | |
env: | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }} | |
CARGO_BUILD_TARGET: ${{ matrix.os.target }} | |
SDKROOT: ${{ matrix.os.SDKROOT }} | |
steps: | |
- name: Load last run details | |
if: github.event_name != 'pull_request' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/rustc-version.txt | |
~/outcome.txt | |
key: | |
CI-${{ matrix.branch }}-${{ runner.os }}-${{ | |
matrix.feature.transport-default }} | |
- name: Install Rust | |
uses: hecrj/setup-rust-action@v1 | |
with: | |
targets: ${{ matrix.os.target }} | |
- 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' && runner.os == 'Linux' && | |
matrix.feature.transport-default | |
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: | |
${{ matrix.os.target }}-${{ steps.sentry-native.outputs.version | |
}}-${{ matrix.feature.transport-default }}-${{ | |
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: Build | |
id: build | |
if: steps.rustc-version.outcome != 'failure' | |
run: cargo -v build ${{ matrix.feature.name }} | |
- name: Test | |
if: | |
always() && steps.build.outcome == 'success' && github.event_name != | |
'pull_request' && matrix.os.test | |
run: cargo -v test ${{ matrix.feature.name }} | |
- name: Example | |
if: | |
always() && steps.build.outcome == 'success' && github.event_name != | |
'pull_request' && matrix.os.test && matrix.feature.transport-default | |
run: cargo -v run --example example ${{ matrix.feature.name }} | |
- name: Custom transport example | |
if: | |
always() && steps.build.outcome == 'success' && github.event_name != | |
'pull_request' && matrix.os.test && matrix.feature.transport-custom | |
run: cargo -v run --example custom-transport ${{ matrix.feature.name }} | |
- name: Save outcome | |
if: | |
always() && steps.rustc-version.outcome != 'failure' && | |
github.event_name != 'pull_request' | |
run: echo ${{ job.status }} > ~/outcome.txt |