Skip to content

Commit

Permalink
build: Reestructure Github Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
felipebz committed May 30, 2024
1 parent bd12517 commit f91a419
Showing 1 changed file with 44 additions and 34 deletions.
78 changes: 44 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,40 @@ on:
branches:
- main

env:
JAVA_VERSION: 21

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
run: ./gradlew build publishToMavenLocal --build-cache

- name: Build custom rules example
run: ./gradlew build -p plsql-custom-rules

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: '**/build/'
retention-days: 1

integration-tests:
name: IT
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -27,16 +58,15 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
run: ./gradlew build publishToMavenLocal -x dokkaJavadoc -x test --refresh-dependencies

- name: Build custom rules example
run: ./gradlew build -p plsql-custom-rules
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts

- if: ${{ !contains(matrix.sqVersion, 'SNAPSHOT') }}
name: Run integration test
Expand All @@ -52,26 +82,9 @@ jobs:
env:
AUTH_REPOSITORY: ${{ secrets.AUTH_REPOSITORY }}

windows-build:
name: Test on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
run: ./gradlew test

linux-build:
name: Build and release
needs: [integration-tests, windows-build]
release:
name: Release
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -81,13 +94,15 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
run: ./gradlew build --refresh-dependencies
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts

- if: github.ref == 'refs/heads/main'
name: Run SonarQube Scanner
Expand All @@ -113,10 +128,5 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3

0 comments on commit f91a419

Please sign in to comment.