-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (80 loc) · 2.55 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- 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 }}