Skip to content

vaas-rust-ci

vaas-rust-ci #263

Workflow file for this run

name: vaas-rust-ci
on:
push:
branches:
- main
paths:
- "rust/**"
- ".github/workflows/ci-rust.yaml"
tags:
- "rs*"
pull_request:
branches:
- main
paths:
- "rust/**"
- ".github/workflows/ci-rust.yaml"
workflow_dispatch:
jobs:
build-rust:
name: Build & Test Rust SDK
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v3
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
working-directory: rust
- name: run tests
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/rs')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
run: cargo test
working-directory: rust
- name: run tests staging
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/rs')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
run: cargo test
working-directory: rust
- name: extract version
if: startsWith(github.ref, 'refs/tags/rs')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/rs}" >> $GITHUB_ENV
echo $RELEASE_VERSION
- name: set version
if: startsWith(github.ref, 'refs/tags/rs')
run: |
sed -i "s/version = \"0.0.0\"/version = \"$RELEASE_VERSION\"/g" ./rust/Cargo.toml
- name: publish crates.io package
if: startsWith(github.ref, 'refs/tags/rs')
run: cargo publish --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
working-directory: rust
- name: Microsoft Teams Notification
uses: skitionek/notify-microsoft-teams@master
if: failure()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
overwrite: "{title: `Failed workflow on for VaaS-SDK ${workflow}`, sections: [{activityTitle: 'build failed', activitySubtitle: `Failed workflow on for VaaS-SDK ${workflow}`, activityImage: 'https://adaptivecards.io/content/cats/3.png'}], themeColor: '#ff0000'}"