Continuous Integration #444
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: Continuous Integration | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
schedule: | |
- cron: "5 6 * * *" | |
repository_dispatch: | |
types: [ liquibase-ci ] | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build & Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Install liquibase-core 0-SNAPSHOT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn -B clean liquibase-sdk:install-snapshot -Dliquibase.sdk.branchSearch=MATCHING_BRANCHES,master | |
- name: Build and Package | |
run: mvn -B dependency:go-offline clean package -DskipTests=true | |
- name: Save Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: liquibase-hanadb-artifacts | |
path: | | |
target/*.jar | |
- name: Save Event File | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} | |
- name: Build Cache | |
uses: actions/[email protected] | |
with: | |
key: build-${{ github.run_number }}-${{ github.run_attempt }} | |
path: | | |
**/target/** | |
~/.m2/repository/org/liquibase/ | |
unit-test: | |
name: Test Java ${{ matrix.java }} | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [ 8, 11, 17, 20 ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v2 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Build Cache | |
uses: actions/[email protected] | |
with: | |
key: build-${{ github.run_number }}-${{ github.run_attempt }} | |
path: | | |
**/target/** | |
~/.m2/repository/org/liquibase/ | |
- name: Run Tests | |
run: mvn -B jacoco:prepare-agent surefire:test | |
- name: Archive Test Results | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-reports-jdk-${{ matrix.java }} | |
path: | | |
**/target/surefire-reports | |
**/target/jacoco.exec | |
integration-test: | |
name: Integration Test | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Build Cache | |
uses: actions/[email protected] | |
with: | |
key: build-${{ github.run_number }}-${{ github.run_attempt }} | |
path: | | |
**/target/** | |
~/.m2/repository/org/liquibase/ | |
- name: Start Hana | |
run: | | |
mkdir ./HXE | |
chmod 777 ./HXE | |
HXE_VERSION=2.00.061.00.20220519.1 | |
echo "{\"master_password\" : \"L1qu1base_test\"}" > ./HXE/passwords.json | |
chmod 777 ./HXE/passwords.json | |
docker pull saplabs/hanaexpress:$HXE_VERSION | |
docker run -d \ | |
-p 39013:39013 \ | |
-p 39015:39015 \ | |
-p 39017:39017 \ | |
-p 39041-39045:39041-39045 \ | |
-p 1128-1129:1128-1129 \ | |
-p 59013-59014:59013-59014 \ | |
-v $(pwd)/HXE:/hana/mounts \ | |
--ulimit nofile=1048576:1048576 \ | |
--sysctl kernel.shmmax=1073741824 \ | |
--sysctl net.ipv4.ip_local_port_range='40000 60999' \ | |
--sysctl kernel.shmall=8388608 \ | |
--name HXE \ | |
saplabs/hanaexpress:$HXE_VERSION \ | |
--passwords-url file:///hana/mounts/passwords.json \ | |
--agree-to-sap-license | |
sleep 10 | |
timeout 500 sh -c ' | |
while true; do | |
STARTING_CONTAINERS=`docker ps --filter "name=HXE" --format "{{.Names}} {{.Status}}" | grep "health: starting" | wc -l`; | |
echo "Waiting for $STARTING_CONTAINERS HANA container(s) to finish startup"; | |
if [ $STARTING_CONTAINERS -ne 1 ]; then | |
break; | |
fi; | |
sleep 5; | |
done | |
' | |
docker ps -a | |
docker logs HXE | |
docker exec HXE bash -l -c "hdbsql -u SYSTEM -p L1qu1base_test -i 90 -d HXE 'CREATE USER LIQUIBASE_TEST PASSWORD L1qu1base_test NO FORCE_FIRST_PASSWORD_CHANGE'" | |
- name: Run Integration Tests | |
run: mvn -B verify | |
- name: Archive Test Results | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-reports-integration | |
path: target/failsafe-reports | |
dependabot: | |
name: Merge dependabot | |
runs-on: ubuntu-latest | |
needs: integration-test | |
permissions: | |
contents: write | |
pull-requests: write | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
steps: | |
- name: Dependabot metadata | |
id: dependabot-metadata | |
uses: dependabot/[email protected] | |
- name: Approve patch and minor updates | |
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}} | |
run: | | |
gh pr merge --auto --merge "$PR_URL" | |
gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a patch or minor update**" | |
env: | |
PR_URL: ${{github.event.pull_request.html_url}} | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |