test: fix #105
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: Build & Test | |
env: | |
APP_NAME: photomanager | |
CARGO_TERM_COLOR: always | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "README.md" | |
# pull_request: | |
# branches: [ main ] | |
concurrency: | |
group: deploytoprod | |
cancel-in-progress: true | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
# for clippy-check and audit-check | |
permissions: write-all | |
outputs: | |
github-sha: ${{ steps.set-outputs.outputs.github-sha }} | |
app-name: ${{ steps.set-outputs.outputs.app-name }} | |
steps: | |
- name: Install rust stable with rustfmt and clippy | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-audit binary crate | |
uses: actions-rs/[email protected] | |
with: | |
crate: cargo-audit | |
version: latest | |
use-tool-cache: true | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
# args: --release --all-features | |
- name: cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --verbose -- -D warnings | |
# in Workflow Permissions section give actions Read and Write permissions | |
# at https://github.com/OWNER/REPO/settings/actions-rs for this to work | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
- name: Security audit | |
uses: actions-rs/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Export env vars | |
id: set-outputs | |
run: | | |
echo "github-sha=${GITHUB_SHA}" >> "$GITHUB_OUTPUT" | |
echo "app-name=${APP_NAME}" >> "$GITHUB_OUTPUT" | |
build-docker: | |
needs: [ build-test ] | |
uses: alexandervantrijffel/workflows/.github/workflows/deploy-docker-kustomize-v2.yaml@main | |
with: | |
app-name: ${{ needs.build-test.outputs.app-name }} | |
docker-image: ci/${{ github.job }} | |
github-sha: ${{ needs.build-test.outputs.github-sha }} | |
build-number: ${{ github.run_number }} | |
secrets: | |
k3s-dac-deploy-key: ${{ secrets.K3S_DAC_DEPLOY_KEY }} | |
registry: ${{ secrets.REGISTRY_URL }} | |
registry-username: ${{ secrets.REGISTRY_USERNAME }} | |
registry-password: ${{ secrets.REGISTRY_PASSWORD }} | |
gh-pat-token: ${{ secrets.GH_PAT_TOKEN }} |