-
Notifications
You must be signed in to change notification settings - Fork 18
212 lines (174 loc) · 6.4 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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.BOT_TOKEN }}
run: |
mvn -B versions:set-property -Dproperty=liquibase-core.version -DnewVersion=0-SNAPSHOT
mvn -B liquibase-sdk:install-snapshot \
"-Dliquibase.sdk.branchSearch=${{ steps.configure-build.outputs.liquibaseBranch }},master,main" \
"-Dliquibase.sdk.repo=liquibase/liquibase,liquibase/liquibase-pro"
- 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-redshift-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 ]
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 -Dtest="RedshiftDatabaseTest" -DfailIfNoTests=true
- 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
prepare-database:
name: Clean and initialize database
needs: build
runs-on: ubuntu-latest
container:
image: liquibase/liquibase:latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: liquibase-redshift-artifacts
- name: Download AWS Redshift driver
run: wget https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/2.1.0.14/redshift-jdbc42-2.1.0.14.jar
- name: Add Redshift extension and driver to liquibase classpath
run: |
cp redshift-jdbc42-2.1.0.14.jar /liquibase/lib/
cp liquibase-redshift-0-SNAPSHOT.jar /liquibase/lib/
- name: Clean AWS Redshift Database
run: liquibase --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ secrets.TH_REDSHIFTURL }}" dropAll
- name: Init Database
run: liquibase --classpath="src/test/resources" --changeLogFile="harness.initScript.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ secrets.TH_REDSHIFTURL }}" update
integration-test:
name: Test Harness for Redshift ${{ matrix.redshift }}
needs: prepare-database
runs-on: ubuntu-latest
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.PRO_LICENSE_KEY }}
strategy:
fail-fast: false
matrix:
redshift: [ "" ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
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: Debug
run: |
pwd
ls -l
ls -l ~/.m2/repository/org/liquibase/liquibase-commercial/
mvn dependency:tree
- name: Harness Test Run
run: mvn -Dtest="LiquibaseHarnessSuiteIT" -DdbName=redshift -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl=${{secrets.TH_REDSHIFTURL}} test
- name: Foundational Harness Test Run
run: mvn -Dtest="LiquibaseHarnessFoundationalSuiteTest" -DdbName=redshift -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl=${{secrets.TH_REDSHIFTURL}} test
- name: Advanced Harness Test Run
run: mvn -Dtest="LiquibaseHarnessAdvancedSuiteTest" -DdbName=redshift -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl=${{secrets.TH_REDSHIFTURL}} test
- name: Archive Redshift Test Results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: redshift-test-results
path: build/spock-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}}