updated workflow with workload identity federation #4
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: database-goodies | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Oracle JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 8 | |
distribution: 'zulu' | |
cache: maven | |
- name: Copy Maven settings | |
run: | | |
mkdir -p $HOME/.m2 | |
cp ./travis/maven-settings.xml $HOME/.m2/settings.xml | |
- name: Update pom.xml version | |
run: | | |
sed -i "s/-SNAPSHOT/-build-${{ github.run_number }}/" pom.xml | |
- name: Disable SourceClear except for cron jobs | |
run: | | |
if [ "${{ github.event_name }}" != "schedule" ]; then | |
export NOSCAN=1 | |
fi | |
- name: Install PostgreSQL 9.6 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y postgresql-9.6 postgresql-contrib-9.6 | |
- name: Set up PostgreSQL 9.6 | |
run: | | |
sudo service postgresql start | |
sudo -u postgres psql -c "create user test with password '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 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
project_id: 'som-rit-infrastructure-prod' | |
workload_identity_provider: 'projects/294515190965/locations/global/workloadIdentityPools/github/providers/susom-github' | |
- name: Set up Oracle JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 8 | |
distribution: 'zulu' | |
cache: maven | |
- name: Copy Maven settings | |
run: | | |
mkdir -p $HOME/.m2 | |
cp ./travis/maven-settings.xml $HOME/.m2/settings.xml | |
- name: Update pom.xml version | |
run: | | |
sed -i "s/-SNAPSHOT/-build-${{ github.run_number }}/" pom.xml | |
- name: Deploy snapshots | |
run: | | |
mvn --batch-mode -e -DskipTests=true deploy |