k8s, ci changes and formatting #85
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: Test and Build Wasm OIDC Plugin | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
container: | |
image: antonengelhardt/rust-docker-tools | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cargo Deny | |
uses: EmbarkStudios/cargo-deny-action@v1 | |
- name: Rust version | |
run: rustc --version && cargo --version | |
- name: Clippy | |
run: cargo clippy --release --all-targets --target=wasm32-wasi | |
- name: Fmt | |
run: cargo fmt -- --check | |
- name: Test | |
run: cargo test --workspace | |
- name: Build | |
run: cargo build --release --target wasm32-wasi | |
build: | |
name: Build Plugin and publish artifact | |
needs: test | |
runs-on: ubuntu-latest | |
container: | |
image: antonengelhardt/rust-docker-tools | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
cargo build --target wasm32-wasi --release | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wasm_oidc_plugin.wasm | |
path: target/wasm32-wasi/release/wasm_oidc_plugin.wasm | |
docker-image: | |
name: Build and push Docker image | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: antonengelhardt/wasm-oidc-plugin:latest | |
ghcr-image: | |
name: Build and push GHCR image | |
runs-on: ubuntu-latest | |
needs: test | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to GHCR | |
run: | | |
docker build -t ghcr.io/antonengelhardt/wasm-oidc-plugin:latest . | |
docker push ghcr.io/antonengelhardt/wasm-oidc-plugin:latest | |
deploy-demo: | |
name: Deploy to demo site | |
needs: ghcr-image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} | |
with: | |
args: rollout restart deployment wasm-oidc-plugin -n wasm-oidc-plugin |