Skip to content

Integration Tests #1904

Integration Tests

Integration Tests #1904

# Copyright 2024 Google LLC
#
# 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.
# Github action job to test core java library features on
# downstream client libraries before they are released.
name: Integration Tests
on:
push:
branches-ignore:
- 'dependabot/**'
workflow_dispatch:
schedule:
- cron: '00 8 * * *' # 08:00 UTC every day
jobs:
integrationTests:
if: github.repository == 'GoogleCloudPlatform/cloud-spanner-r2dbc'
runs-on: ubuntu-20.04
permissions:
contents: 'read'
id-token: 'write'
strategy:
fail-fast: true
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d' --utc)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- uses: actions/cache@v3
id: mvn-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.date }}
- name: Set Up Authentication
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.CLOUD_SPANNER_R2DBC_CI_SA_KEY }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
version: latest
project_id: cloud-spanner-r2dbc-ci
export_default_credentials: true
- name: Maven go offline
id: mvn-offline
if: steps.mvn-cache.outputs.cache-hit != 'true'
run: ./mvnw compile dependency:go-offline
- name: Mvn install # Need this when the directory/pom structure changes
id: install1
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
install
- name: Retry install on failure
id: install2
if: steps.install1.outcome == 'failure'
run: |
./mvnw \
--batch-mode \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
install
- name: Wait our turn for running integration tests
uses: softprops/turnstyle@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
continue-after-seconds: 1200 # 30 min
same-branch-only: false
- name: Integration Tests
id: intTest1
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--define maven.javadoc.skip=true \
--define skip.surefire.tests=true \
verify
- name: Retry on Failure
id: intTest2
if: steps.intTest1.outcome == 'failure'
run: |
./mvnw \
--batch-mode \
--define maven.javadoc.skip=true \
--define skip.surefire.tests=true \
verify
- name: Aggregate Report
run: |
./mvnw \
--batch-mode \
--define aggregate=true \
surefire-report:failsafe-report-only
- name: Archive logs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: Integration Test Logs - ${{ matrix.it}}
path: |
**/target/failsafe-reports/*
**/target/site