Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 35 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ env:
MAVEN_CLI_OPTS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'

jobs:
# Notify build started (for PRs)
notify-start:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Post PR comment
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `🚀 Build started! [View workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`
})

# Incremental build for PRs
incremental-build:
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -99,14 +83,34 @@ jobs:
- name: Full build (excluding itests)
run: mvn clean install $MAVEN_CLI_OPTS -P !itests

# DDF Core integration tests
- name: Build itest dependencies
run: |
mvn install $MAVEN_CLI_OPTS \
-pl distribution/test/itests/test-itests-common,distribution/test/itests/test-itests-dependencies-app \
-am \
-DskipTests=true

- name: Run DDF Core integration tests
run: |
unset JAVA_TOOL_OPTIONS
mvn install $MAVEN_CLI_OPTS \
-pl distribution/test/itests/test-itests-ddf-core \
-nsu

# DDF Core integration tests (for PRs)
integration-tests:
needs: [incremental-build, full-build]
# Run if either build succeeded (one will be skipped based on event type)
if: always() && (needs.incremental-build.result == 'success' || needs.full-build.result == 'success')
needs: incremental-build
if: github.event_name == 'pull_request' && needs.incremental-build.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
df -h

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -117,6 +121,9 @@ jobs:
distribution: 'temurin'
cache: maven

- name: Quick install (skip tests)
run: mvn install $MAVEN_CLI_OPTS -DskipStatic=true -DskipTests=true

- name: Run DDF Core integration tests
run: |
unset JAVA_TOOL_OPTIONS
Expand Down Expand Up @@ -204,12 +211,12 @@ jobs:

# Deploy artifacts (master and patch branches only, in production)
deploy:
needs: [integration-tests, dependency-check]
needs: [full-build, dependency-check]
if: |
always() &&
github.event_name != 'pull_request' &&
(github.ref == 'refs/heads/master' || contains(github.ref, '.x')) &&
needs.integration-tests.result == 'success' &&
needs.full-build.result == 'success' &&
needs.dependency-check.result == 'success'
runs-on: ubuntu-latest
environment: production
Expand All @@ -229,14 +236,9 @@ jobs:
with:
servers: |
[{
"id": "releases",
"username": "${{ secrets.MAVEN_USERNAME }}",
"password": "${{ secrets.MAVEN_PASSWORD }}"
},
{
"id": "snapshots",
"username": "${{ secrets.MAVEN_USERNAME }}",
"password": "${{ secrets.MAVEN_PASSWORD }}"
"id": "github",
"username": "${{ github.actor }}",
"password": "${{ secrets.GITHUB_TOKEN }}"
}]

- name: Login to Docker Hub
Expand All @@ -250,62 +252,6 @@ jobs:
mvn deploy $MAVEN_CLI_OPTS \
-DskipStatic=true \
-DskipTests=true \
-DretryFailedDeploymentCount=10

# Final status notification
notify-result:
needs: [incremental-build, full-build, integration-tests, dependency-check]
if: always()
runs-on: ubuntu-latest
steps:
- name: Determine build result
id: result
run: |
if [[ "${{ needs.incremental-build.result }}" == "failure" ]] || \
[[ "${{ needs.full-build.result }}" == "failure" ]] || \
[[ "${{ needs.integration-tests.result }}" == "failure" ]] || \
[[ "${{ needs.dependency-check.result }}" == "failure" ]]; then
echo "status=failure" >> $GITHUB_OUTPUT
else
echo "status=success" >> $GITHUB_OUTPUT
fi

- name: Post PR comment with result
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const status = '${{ steps.result.outputs.status }}';
const emoji = status === 'success' ? '✅' : '❌';
const message = status === 'success' ? 'Build succeeded!' : 'Build failed.';
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `${emoji} ${message} [View workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`
})

- name: Slack notification
if: github.event_name != 'pull_request'
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"text": "${{ steps.result.outputs.status == 'success' && 'SUCCESS' || 'FAILURE' }}: ${{ github.repository }} - ${{ github.ref_name }} #${{ github.run_number }}",
"attachments": [
{
"color": "${{ steps.result.outputs.status == 'success' && 'good' || 'danger' }}",
"fields": [
{
"title": "Workflow",
"value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>",
"short": true
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
continue-on-error: true # Don't fail if Slack is not configured
-DretryFailedDeploymentCount=10 \
-Dreleases.repository.url=https://maven.pkg.github.com/codice/ddf \
-Dsnapshots.repository.url=https://maven.pkg.github.com/codice/ddf
12 changes: 7 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,16 @@
</dependencies>
</dependencyManagement>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>${snapshots.repository.url}</url>
</snapshotRepository>
<repository>
<id>releases</id>
<id>github</id>
<name>GitHub Packages</name>
<url>${releases.repository.url}</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>GitHub Packages</name>
<url>${snapshots.repository.url}</url>
</snapshotRepository>
<site>
<id>reports</id>
<url>${reports.repository.url}</url>
Expand Down
Loading