feat: add cli test mode #490
Workflow file for this run
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: 'CI' | |
on: | |
pull_request: | |
branches: | |
- main | |
- add-profile-tests | |
paths-ignore: | |
- '**/*.yaml' | |
- '**/*.md' | |
- LICENSE | |
- CODEOWNERS | |
- '.gitignore' | |
jobs: | |
govulncheck: | |
runs-on: ubuntu-latest | |
name: Run govulncheck | |
steps: | |
- id: govulncheck | |
uses: golang/govulncheck-action@v1 | |
with: | |
go-version-file: go.mod | |
go-package: ./... | |
golangci: | |
name: lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version-file: 'go.mod' | |
cache: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 | |
with: | |
version: v1.55 | |
# Optional: golangci-lint command line arguments. | |
args: --timeout=10m | |
unit: | |
name: unit tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version-file: 'go.mod' | |
cache: false | |
- name: Unit Tests with the Go CLI | |
run: go test ./... -short -race -cover | |
end-to-end: | |
name: e2e tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Check out platform | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
repository: opentdf/platform | |
path: platform | |
- name: Set up go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | |
with: | |
go-version-file: 'platform/service/go.mod' | |
check-latest: false | |
cache-dependency-path: | | |
platform/service/go.sum | |
platform/protocol/go/go.sum | |
platform/sdk/go.sum | |
- run: | | |
.github/scripts/init-temp-keys.sh | |
cp opentdf-dev.yaml opentdf.yaml | |
working-directory: platform | |
- name: Added Trusted Certs | |
run: | | |
sudo chmod -R 777 ./keys | |
sudo apt-get install -y ca-certificates | |
sudo cp ./keys/localhost.crt /usr/local/share/ca-certificates | |
sudo update-ca-certificates | |
working-directory: platform | |
- run: docker compose up -d --wait --wait-timeout 240 | |
working-directory: platform | |
- run: go run ./service provision keycloak | |
working-directory: platform | |
- run: go run ./service provision fixtures | |
working-directory: platform | |
- uses: JarvusInnovations/background-action@2428e7b970a846423095c79d43f759abf979a635 | |
name: start server in background | |
with: | |
run: > | |
go build -o opentdf -v service/main.go | |
&& .github/scripts/watch.sh opentdf.yaml ./opentdf start | |
wait-on: | | |
tcp:localhost:8080 | |
log-output-if: true | |
wait-for: 90s | |
working-directory: platform | |
- name: build the CLI | |
run: go build . | |
- name: build the CLI in test mode | |
run: make build-test | |
- name: set up the config | |
run: cp otdfctl-example.yaml otdfctl.yaml | |
- name: Setup Bats and bats libs | |
uses: bats-core/[email protected] | |
- run: tests/encrypt-decrypt.bats | |
- run: tests/kas-grants.bats | |
- run: tests/profile.bats |