Skip to content

Merge pull request #109 from maxlaverse/dependabot/go_modules/github.… #217

Merge pull request #109 from maxlaverse/dependabot/go_modules/github.…

Merge pull request #109 from maxlaverse/dependabot/go_modules/github.… #217

Workflow file for this run

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:latest
env:
ADMIN_TOKEN: test1234
I_REALLY_WANT_VOLATILE_STORAGE: "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.1.0" >> $GITHUB_OUTPUT
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.19.0'
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v3
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@v3
with:
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Binaries Cache
uses: actions/cache@v3
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
run: go test -coverprofile=profile.cov -v ./...
env:
VAULTWARDEN_HOST: "127.0.0.1"
VAULTWARDEN_PORT: "8080"
TF_ACC: "1"
- name: Code Coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov