-
Notifications
You must be signed in to change notification settings - Fork 7
104 lines (86 loc) · 3.02 KB
/
database-goodies.yaml
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
name: database-goodies
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 8 * * *"
permissions:
id-token: write
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Oracle JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: maven
- name: Copy Maven settings
run: |
mkdir -p $HOME/.m2
cp ./travis/actions-maven-settings.xml $HOME/.m2/settings.xml
- name: Update pom.xml version
run: |
sed -i "s/-SNAPSHOT/-github-build-${{ github.run_number }}/" pom.xml
- name: Install PostgreSQL 14
run: |
sudo apt-get update
sudo apt-get install -y postgresql-14 postgresql-contrib
- name: Configure PostgreSQL for trust authentication
run: |
sudo sed -i "s/peer/trust/" /etc/postgresql/14/main/pg_hba.conf
sudo sed -i "s/scram-sha-256/trust/" /etc/postgresql/14/main/pg_hba.conf
sudo service postgresql restart
- name: Set up PostgreSQL
run: |
sudo service postgresql start
sudo -u postgres psql -c "create user test;"
sudo -u postgres psql -c "create database test owner test;"
- name: Run tests
run: |
mvn -e test
mvn -e -Ppostgresql -Dpostgres.database.url=jdbc:postgresql:test -Dpostgres.database.user=test -Dpostgres.database.password=test verify
- name: Show test reports on failure
if: failure()
run: |
echo "\n=== SUREFIRE REPORTS ===\n"
for F in target/surefire-reports/*.txt; do echo $F; cat $F; echo; done
deploy-snapshots:
runs-on: ubuntu-latest
if: github.repository == 'susom/database-goodies' && github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.WORKLOAD_IDENTITY_PROJECT }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
create_credentials_file: true
export_environment_variables: true
cleanup_credentials: true
- name: Set up OAuth2 access token for Maven
run: |
echo "ACCESS_TOKEN=$(gcloud auth print-access-token)" >> $GITHUB_ENV
- name: Set up Oracle JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: maven
- name: Copy Maven settings
run: |
mkdir -p $HOME/.m2
cp ./travis/actions-maven-settings.xml $HOME/.m2/settings.xml
- name: Update pom.xml version
run: |
sed -i "s/-SNAPSHOT/-github-build-${{ github.run_number }}/" pom.xml
- name: Deploy snapshots
run: |
mvn --batch-mode -e -DskipTests=true deploy