ci: fix license check job #1290
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: "Checks" | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
merge_group: | |
branches: | |
- main | |
types: | |
- checks_requested | |
jobs: | |
pr: | |
name: Validate PR title | |
if: contains(fromJSON('["pull_request", "pull_request_target"]'), github.event_name) | |
runs-on: ubuntu-22.04 | |
permissions: | |
pull-requests: read | |
steps: | |
- uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
go: | |
runs-on: ubuntu-22.04 | |
permissions: | |
checks: write | |
contents: read | |
pull-requests: read | |
strategy: | |
matrix: | |
directory: | |
- "." | |
- sdk | |
- examples | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: "1.21.8" | |
cache-dependency-path: | | |
./go.sum | |
examples/go.sum | |
protocol/go/go.sum | |
sdk/go.sum | |
- run: make go.work | |
- run: go mod download | |
- run: go mod verify | |
- name: golangci-lint | |
#uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 | |
uses: strantalis/golangci-lint-action@f4e979f5b36068d69d340547f66c991dca8b70ef | |
with: | |
version: v1.56 | |
working-directory: ${{ matrix.directory }} | |
skip-cache: true | |
only-new-issues: ${{ (github.event_name == 'pull_request' || github.event_name == 'merge_group') }} | |
- name: Install softHSM | |
if: matrix.directory == '.' | |
run: |- | |
sudo apt-get install -y softhsm opensc openssl | |
sudo chmod +x /etc/softhsm | |
sudo chmod +r /etc/softhsm/softhsm2.conf | |
mkdir -p $(pwd)/.tmp/tokens | |
echo "directories.tokendir = $(pwd)/.tmp/tokens" > softhsm2.conf | |
echo "log.level = DEBUG" >> softhsm2.conf | |
echo "SOFTHSM2_CONF=$(pwd)/softhsm2.conf" >> "$GITHUB_ENV" | |
- run: go test ./... -short | |
working-directory: ${{ matrix.directory }} | |
integration: | |
name: integration tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: "1.21.8" | |
cache-dependency-path: | | |
./go.sum | |
examples/go.sum | |
protocol/go/go.sum | |
sdk/go.sum | |
- run: make go.work | |
- run: go mod download | |
- run: go mod verify | |
- run: go test ./integration -race | |
- name: Install softHSM | |
run: |- | |
sudo apt-get install -y softhsm opensc openssl | |
sudo chmod +x /etc/softhsm | |
sudo chmod +r /etc/softhsm/softhsm2.conf | |
mkdir -p $(pwd)/.tmp/tokens | |
echo "directories.tokendir = $(pwd)/.tmp/tokens" > softhsm2.conf | |
echo "log.level = DEBUG" >> softhsm2.conf | |
echo "SOFTHSM2_CONF=$(pwd)/softhsm2.conf" >> "$GITHUB_ENV" | |
- run: .github/scripts/hsm-init-temporary-keys.sh | |
- run: docker compose up -d --wait --wait-timeout 240 | |
- run: cp example-opentdf.yaml opentdf.yaml | |
- uses: JarvusInnovations/background-action@313d37130873d82c33fc907b9b78e932aec8e990 | |
name: start server in background | |
with: | |
run: | | |
go run . start | |
wait-on: | | |
tcp:localhost:9000 | |
log-output-if: true | |
wait-for: 90s | |
- run: go install github.com/fullstorydev/grpcurl/cmd/[email protected] | |
- run: grpcurl -plaintext localhost:9000 list | |
- run: grpcurl -plaintext localhost:9000 grpc.health.v1.Health.Check | |
- run: curl --show-error --fail --insecure localhost:8080/kas/v2/kas_public_key | |
image: | |
name: image build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/[email protected] | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
buflint: | |
name: Protocol Buffer Lint and Gencode Up-to-date check | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: bufbuild/buf-setup-action@382440cdb8ec7bc25a68d7b4711163d95f7cc3aa | |
- uses: bufbuild/buf-lint-action@044d13acb1f155179c606aaa2e53aea304d22058 | |
with: | |
input: services | |
- uses: bufbuild/buf-breaking-action@a074e988ee34efcd4927079e79c611f428354c01 | |
# TODO(#212) Block on breaking changes after protos are frozen | |
continue-on-error: true | |
with: | |
input: services | |
against: "https://github.com/opentdf/platform.git#branch=main,subdir=services" | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: "1.21.8" | |
cache-dependency-path: | | |
./go.sum | |
protocol/go/go.sum | |
sdk/go.sum | |
examples/go.sum | |
- run: go get github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc | |
- run: go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc | |
- run: rm -rf sdkjava/io sdkjava/src protocol/go/ | |
- run: make proto-generate | |
- name: Restore go.mod after installing protoc-gen-doc | |
run: git restore {.,protocol/go}/go.{mod,sum} | |
- run: git diff | |
- run: git diff-files --ignore-submodules | |
- name: Check that files have been formatted before PR submission | |
run: git diff-files --quiet --ignore-submodules | |
javasdk: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: | |
- buflint | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "20" | |
distribution: "adopt" | |
server-id: github | |
- name: Compile Java SDK | |
run: | | |
mvn -f sdkjava/pom.xml clean install | |
ci: | |
needs: | |
- buflint | |
- go | |
- image | |
- integration | |
- javasdk | |
- pr | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- if: contains(needs.*.result, 'failure') | |
run: echo "Failed due to ${{ contains(needs.*.result, 'failure') }}" && exit 1 | |
license: | |
name: license check | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: "1.21.8" | |
cache: false | |
- run: make go.work | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 | |
id: deps-changed | |
with: | |
filters: | | |
examples: | |
- 'examplesk/go.*' | |
platform: | |
- './go.*' | |
sdk: | |
- 'sdk/go.*' | |
- name: install go-licenses | |
run: go install github.com/google/go-licenses@5348b744d0983d85713295ea08a20cca1654a45e | |
- name: check platform licenses | |
if: steps.deps-changed.outputs.platform == 'true' | |
run: > | |
go-licenses check --disallowed_types=forbidden --include_tests | |
--ignore github.com/opentdf/platform/sdk | |
--ignore github.com/opentdf/platform/protocol | |
. | |
- name: check sdk licenses | |
if: steps.deps-changed.outputs.sdk == 'true' | |
run: > | |
go-licenses check --disallowed_types=forbidden --include_tests | |
--ignore github.com/opentdf/platform/sdk | |
--ignore github.com/opentdf/platform/protocol | |
./sdk | |
- name: check examples licenses | |
if: steps.deps-changed.outputs.examples == 'true' | |
run: > | |
go-licenses check --disallowed_types=forbidden --include_tests | |
--ignore github.com/opentdf/platform/sdk | |
--ignore github.com/opentdf/platform/protocol | |
./examples |