Skip to content

build(deps): bump the minor-and-patch group across 1 directory with 2 updates #124

build(deps): bump the minor-and-patch group across 1 directory with 2 updates

build(deps): bump the minor-and-patch group across 1 directory with 2 updates #124

name: 'Cross Language Validation'
on:
workflow_dispatch:
inputs:
go-version:
description: 'Go version'
required: false
java-version:
description: 'Java version'
required: false
pull_request:
branches:
- main
paths:
- '.github/workflows/cross-language-validation.yml'
- 'tests/cross-language/**'
- 'go/**'
- 'java/**'
- 'csharp/**'
- 'server/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-cross-lang-${{ github.ref }}
cancel-in-progress: true
env:
DYNAMODB_HOSTNAME: dynamodb
MYSQL_HOSTNAME: mysql
MYSQL_DATABASE: testdb
MYSQL_USERNAME: root
MYSQL_PASSWORD: Password123
DISABLE_TESTCONTAINERS: true
AWS_ACCESS_KEY_ID: dummykey
AWS_SECRET_ACCESS_KEY: dummy_secret
AWS_DEFAULT_REGION: us-west-2
AWS_REGION: us-west-2
jobs:
init-defaults:
name: Init Defaults
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.init.outputs.go-version }}
java-version: ${{ steps.init.outputs.java-version }}
steps:
- id: init
name: Init versions
run: |
go_version="${{ inputs.go-version }}"
if [ -z "${go_version}" ]; then
go_version='stable'
fi
echo "Go version: ${go_version}"
echo "go-version=${go_version}" >> $GITHUB_OUTPUT
java_version="${{ inputs.java-version }}"
if [ -z "${java_version}" ]; then
java_version='17'
fi
echo "Java version: ${java_version}"
echo "java-version=${java_version}" >> $GITHUB_OUTPUT
server-samples:
name: 'Server Samples: Build & Test'
runs-on: ubuntu-latest
needs: init-defaults
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get -y upgrade --fix-missing
sudo apt-get install -y build-essential
- name: Set up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: ${{ needs.init-defaults.outputs.go-version }}
cache-dependency-path: 'go/*/go.sum'
- name: Set up Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: ${{ needs.init-defaults.outputs.java-version }}
distribution: 'temurin'
cache: 'maven'
cache-dependency-path: 'java/*/pom.xml'
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.x'
cache: 'pip'
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: '20.x'
- name: Build the Java project
run: |
mvn -v
# Delete previous builds and rebuild from the current branch
rm -rf ~/.m2/repository/com/godaddy/asherah/grpc-server ~/.m2/repository/com/godaddy/asherah/appencryption
mvn --no-transfer-progress clean install -f java/app-encryption/pom.xml -DskipTests
mvn --no-transfer-progress clean install -f server/java/pom.xml -DskipTests
- name: Test clients
run: |
cd server/samples/clients
./test_clients.sh
cross-language-tests:
name: Cross-Language Tests
runs-on: ubuntu-latest
needs: init-defaults
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_PASSWORD }}
ports:
- 3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up C#
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
with:
dotnet-version: |
3.1.x
6.0.x
- name: Set up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: ${{ needs.init-defaults.outputs.go-version }}
cache-dependency-path: 'go/*/go.sum'
- name: Set up Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: ${{ needs.init-defaults.outputs.java-version }}
distribution: 'temurin'
cache: 'maven'
cache-dependency-path: 'java/*/pom.xml'
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.x'
cache: 'pip'
- name: Initialize RDBMS based metastore
run: |
mysql -h 127.0.0.1 -P${{ job.services.mysql.ports[3306] }} -u ${{ env.MYSQL_USERNAME }} -p${{ env.MYSQL_PASSWORD }} -e "CREATE TABLE ${{ env.MYSQL_DATABASE }}.encryption_key (
id VARCHAR(255) NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
key_record TEXT NOT NULL,
PRIMARY KEY (id, created),
INDEX (created)
);"
- name: Build the Java project
run: |
mvn -v
# Delete previous builds and rebuild from the current branch
rm -rf ~/.m2/repository/com/godaddy/asherah/grpc-server ~/.m2/repository/com/godaddy/asherah/appencryption
mvn --no-transfer-progress clean install -f java/app-encryption/pom.xml -DskipTests
mvn --no-transfer-progress clean install -f server/java/pom.xml -DskipTests
cd tests/cross-language/java
./scripts/build.sh
- name: Build the C# project
run: |
cd tests/cross-language/csharp
./scripts/clean.sh
# Workaround for https://github.com/SpecFlowOSS/SpecFlow/issues/1912#issue-583000545
export MSBUILDSINGLELOADCONTEXT=1
./scripts/build.sh
- name: Download Go dependencies
run: |
cd tests/cross-language/go
# Workaround for https://github.com/golangci/golangci-lint/issues/825
# Without this, the linter may fail with "ERRO Running error: context loading failed: no go files to analyze"
go mod download
- name: Lint the Go project
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: 'v1.60.1'
skip-cache: true
working-directory: 'tests/cross-language/go'
- name: Build the Go project
run: |
cd tests/cross-language/go
go mod edit -replace github.com/godaddy/asherah/go/appencryption=../../../go/appencryption
go install github.com/cucumber/godog/cmd/godog@latest
./scripts/build.sh
- name: Test
env:
TEST_DB_NAME: ${{ env.MYSQL_DATABASE }}
TEST_DB_PASSWORD: ${{ env.MYSQL_PASSWORD }}
TEST_DB_USER: ${{ env.MYSQL_USERNAME }}
TEST_DB_HOSTNAME: localhost
TEST_DB_PORT: ${{ job.services.mysql.ports[3306] }}
ASHERAH_SERVICE_NAME: service
ASHERAH_PRODUCT_NAME: product
ASHERAH_KMS_MODE: static
run: |
export JAVA_AE_VERSION=$(mvn -f java/app-encryption/pom.xml -q -DforceStdout help:evaluate -Dexpression=project.version)
cd tests/cross-language/
./scripts/encrypt_all.sh
./scripts/decrypt_all.sh