Skip to content

Commit

Permalink
Split building and testing in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKunz committed Mar 14, 2024
1 parent 9ffb076 commit f37bb19
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ jobs:
- uses: actions/checkout@v4
- uses: gradle/[email protected]

gradle:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Gradle build, test and check
- name: Gradle build without tests
uses: ./.github/workflows/gradle-goal
with:
command: "./gradlew check"
# We also compile the test-classes, even though we are skipping the tests
command: "./gradlew build testClasses -x test"

- name: Warmup gradle wrapper
uses: ./.github/workflows/gradle-goal
Expand All @@ -42,9 +43,36 @@ jobs:
name: test-results
path: '**/build/test-results/test/TEST-*.xml'

- name: Cache working directory with build results
uses: actions/upload-artifact@v3
with:
name: working-dir-build-cache
path: ./

- name: Agent artifact
uses: actions/upload-artifact@v3
with:
name: elastic-otel-javaagent
path: |
./agent/build/libs/elastic-otel-javaagent-*.jar
test:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download cached build working directory
uses: actions/download-artifact@v3
with:
name: working-dir-build-cache
path: ./
- name: Run tests
uses: ./.github/workflows/gradle-goal
with:
command: "./gradlew test"
- name: Store test results
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: test-results
path: '**/build/test-results/test/TEST-*.xml'

0 comments on commit f37bb19

Please sign in to comment.