-
Notifications
You must be signed in to change notification settings - Fork 11
132 lines (116 loc) · 3.83 KB
/
tests.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Tests
on:
push:
branches: [ main ]
paths:
- 'tools/**'
- 'internal/**'
- '*.go'
- 'go.*'
pull_request:
branches: [ main ]
paths:
- 'tools/**'
- 'internal/**'
- '*.go'
- 'go.*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
services:
vaultwarden:
image: vaultwarden/server:1.32.0
env:
ADMIN_TOKEN: test1234
I_REALLY_WANT_VOLATILE_STORAGE: "true"
DISABLE_ICON_DOWNLOAD: "true"
LOGIN_RATELIMIT_SECONDS: "1"
LOGIN_RATELIMIT_MAX_BURST: "1000000"
ADMIN_RATELIMIT_SECONDS: "1"
ADMIN_RATELIMIT_MAX_BURST: "1000000"
ports:
- 8080:80
options: >-
--health-cmd "curl -f http://localhost:80/"
--health-interval 30s
--health-timeout 10s
--health-retries 5
--health-start-period 15s
steps:
- id: go-cache-paths
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- id: binaries
run: |
echo "LOCAL_BINARIES=$GITHUB_WORKSPACE/bin" >> $GITHUB_OUTPUT
echo "BWCLI_VERSION=2023.2.0" >> $GITHUB_OUTPUT
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.22.0'
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.GOCACHE }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Binaries Cache
uses: actions/cache@v4
with:
path: ${{ steps.binaries.outputs.LOCAL_BINARIES }}
key: ${{ steps.binaries.outputs.BWCLI_VERSION }}
- name: Download Binaries
run: |
echo "${{ steps.binaries.outputs.LOCAL_BINARIES }}" >> $GITHUB_PATH
if [[ -d "${{ steps.binaries.outputs.LOCAL_BINARIES }}" ]]; then
exit 0
fi
wget https://github.com/bitwarden/clients/releases/download/cli-v${{ steps.binaries.outputs.BWCLI_VERSION }}/bw-linux-${{ steps.binaries.outputs.BWCLI_VERSION }}.zip
mkdir -p ${{ steps.binaries.outputs.LOCAL_BINARIES }}
unzip bw-linux-${{ steps.binaries.outputs.BWCLI_VERSION }}.zip
chmod +x bw
mv bw ${{ steps.binaries.outputs.LOCAL_BINARIES }}
- name: Build
run: go build -v ./...
- name: Test with Embedded Client
run: go test -coverprofile=profile.cov -v -coverpkg=./... ./...
env:
VAULTWARDEN_HOST: "127.0.0.1"
VAULTWARDEN_PORT: "8080"
TF_ACC: "1"
TEST_USE_EMBEDDED_CLIENT: "1"
- name: Code Coverage for Embedded Client
continue-on-error: true
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
parallel: true
- name: Test with Official Client
run: go test -coverprofile=profile.cov -timeout 1000s -failfast -v -coverpkg=./... ./...
env:
VAULTWARDEN_HOST: "127.0.0.1"
VAULTWARDEN_PORT: "8080"
TF_ACC: "1"
- name: Code Coverage for Official Client
continue-on-error: true
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
parallel: true
finish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true