Merge pull request #28 from Aiven-Open/gharris1727-patch-1 #65
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
# | |
# Copyright 2024 Copyright 2022 Aiven Oy and | |
# bigquery-connector-for-apache-kafka project contributors | |
# | |
# This software contains code derived from the Confluent BigQuery | |
# Kafka Connector, Copyright Confluent, Inc, which in turn | |
# contains code derived from the WePay BigQuery Kafka Connector, | |
# Copyright WePay, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, | |
# software distributed under the License is distributed on an | |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
# KIND, either express or implied. See the License for the | |
# specific language governing permissions and limitations | |
# under the License. | |
# | |
# Workflow to check pull requests and new commits to main branches | |
# This checks the source in the state as if after the merge. | |
name: Pull request checks | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
# Disallow concurrent runs for the same PR by cancelling in-progress runs | |
# when new commits are pushed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
cache: maven | |
- name: License header check | |
run: | | |
mvn license:remove license:format | |
if [[ -n $(git status -s) ]]; then | |
echo 1>&2 'Some files do not have the correct license header:' | |
git diff --name-only 1>&2 | |
echo 1>&2 'Please update the license headers for these files by running `mvn license:remove license:format`' | |
exit 1 | |
fi | |
- name: Build (Maven) | |
run: mvn -P ci --batch-mode clean package -DskipTests | |
- name: Unit tests (Maven) | |
run: mvn -P ci --batch-mode test | |
- name: Integration tests (Maven) | |
env: | |
# Necessary for client builder integration tests that run with | |
# default application credentials | |
CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS }} | |
GOOGLE_APPLICATION_CREDENTIALS: /tmp/creds.json | |
KCBQ_TEST_KEYFILE: /tmp/creds.json | |
KCBQ_TEST_KEY_SOURCE: FILE | |
KCBQ_TEST_PROJECT: ${{ secrets.KCBQ_TEST_PROJECT }} | |
KCBQ_TEST_DATASET: ${{ secrets.KCBQ_TEST_DATASET }} | |
KCBQ_TEST_BUCKET: ${{ secrets.KCBQ_TEST_BUCKET }} | |
run: | | |
echo "$CREDENTIALS_JSON" > /tmp/creds.json | |
export KCBQ_TEST_TABLE_SUFFIX=_$(date +%s)_$RANDOM | |
mvn -P ci -Dskip.unit.tests=true verify | |
- name: Upload integration test results (Maven) | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
path: kcbq-connector/target/failsafe-reports/* | |
name: integration-test-results |