-
-
Notifications
You must be signed in to change notification settings - Fork 17
84 lines (70 loc) · 2.04 KB
/
build-test.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
name: Build and test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
cargo_test:
name: Cargo tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
# Deploy services used for test (Hashicorp Vault, etc.)
- uses: isbang/[email protected]
with:
compose-file: "./tests/docker-compose.yml"
down-flags: "--volumes"
- run: cargo test
docker_build:
name: Docker build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: "type=local,dest=novops-build"
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: novops-binary
path: |
novops-build/novops
load_novops:
name: run Novops commands
runs-on: ubuntu-latest
needs: docker_build
steps:
- uses: actions/checkout@v3
- name: Download novops artifact
uses: actions/download-artifact@v3
with:
name: novops-binary
- name: novops load
run: |
chmod +x ./novops
./novops load -c tests/.novops.plain-strings.yml -s .envrc -e dev
cat .envrc >> "$GITHUB_ENV"
- name: check novops loaded values
run: env | grep MY_APP_HOST
- name: novops run and check var
run: |
./novops run -c tests/.novops.plain-strings.yml -e dev -- sh -c "env | grep DOG_PATH"