forked from spring-projects/spring-data-neo4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub Actions CI workflows for build, tests, and Maven publishing #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c09d17c
Initial plan
Copilot dbb73dd
Add GitHub Actions workflows for CI/CD
Copilot 2344ec3
Add CI/CD documentation and update README
Copilot f271a45
Enhance workflows with permissions, concurrency, and summaries
Copilot 2d43e06
Add GitHub Actions workflows quick reference guide
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| # GitHub Actions Workflows Quick Reference | ||
|
|
||
| This document provides a quick reference for the GitHub Actions workflows in this repository. | ||
|
|
||
| ## Workflows Overview | ||
|
|
||
| | Workflow | File | Triggers | Purpose | | ||
| |----------|------|----------|---------| | ||
| | Build & Test | `build.yml` | PR, Push to main/release | Validate code changes | | ||
| | Publish to Maven | `publish.yml` | Push to main/release, Manual | Deploy SNAPSHOT artifacts | | ||
| | CodeQL | `codeql.yml` | PR, Push, Schedule | Security analysis | | ||
| | Project Management | `project.yml` | Issues, PR events | Automate issue tracking | | ||
|
|
||
| ## Build & Test Workflow | ||
|
|
||
| ### When it runs | ||
| - On pull requests to `main` or release branches (`X.X.x`) | ||
| - On pushes to `main` or release branches | ||
|
|
||
| ### What it does | ||
| 1. Checks out code | ||
| 2. Sets up Java 17 (Temurin) | ||
| 3. Starts FalkorDB service (port 6379) | ||
| 4. Runs Maven build with tests and checkstyle | ||
| 5. Uploads test results | ||
| 6. Publishes test report | ||
|
|
||
| ### Environment | ||
| - **Java**: 17 | ||
| - **Maven**: Via wrapper | ||
| - **FalkorDB**: Latest (Docker service) | ||
|
|
||
| ### Required Secrets | ||
| None | ||
|
|
||
| ### Configuration | ||
| Modify `build.yml` to: | ||
| - Change Java version: Update `java-version` in setup-java step | ||
| - Adjust FalkorDB version: Update `image` in services section | ||
| - Customize Maven goals: Edit `run` in "Build with Maven" step | ||
|
|
||
| ## Publish to Maven Workflow | ||
|
|
||
| ### When it runs | ||
| - On pushes to `main` or release branches | ||
| - Manually via workflow_dispatch | ||
|
|
||
| ### What it does | ||
| 1. Checks out code | ||
| 2. Sets up Java 17 (Temurin) | ||
| 3. Starts FalkorDB service for tests | ||
| 4. Builds and deploys to Maven repository | ||
| 5. Uploads build artifacts | ||
|
|
||
| ### Environment | ||
| - **Java**: 17 | ||
| - **Maven**: Via wrapper with settings.xml | ||
| - **FalkorDB**: Latest (Docker service) | ||
|
|
||
| ### Required Secrets | ||
| - `ARTIFACTORY_USERNAME` - Maven repository username | ||
| - `ARTIFACTORY_PASSWORD` - Maven repository password/token | ||
|
|
||
| ### Configuration | ||
| Modify `publish.yml` to: | ||
| - Change deployment target: Update `settings.xml` in project root | ||
| - Adjust artifact retention: Change `retention-days` in Upload Artifacts step | ||
| - Customize Maven goals: Edit `run` in "Build and Deploy" step | ||
|
|
||
| ## Manual Workflow Dispatch | ||
|
|
||
| To manually trigger the Publish workflow: | ||
|
|
||
| 1. Go to Actions tab in GitHub | ||
| 2. Select "Publish to Maven" workflow | ||
| 3. Click "Run workflow" | ||
| 4. Select branch (usually `main`) | ||
| 5. Click "Run workflow" button | ||
|
|
||
| ## Workflow Status | ||
|
|
||
| View workflow status at: | ||
| - Repository Actions tab: `https://github.com/FalkorDB/spring-data-falkordb/actions` | ||
| - Pull requests: Status checks section | ||
| - Commits: Commit status icons | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Build Failures | ||
|
|
||
| **Problem**: Tests fail with "Connection refused" to FalkorDB | ||
| - **Cause**: FalkorDB service not ready | ||
| - **Solution**: Health check should handle this automatically; if persists, increase health check retries in workflow | ||
|
|
||
| **Problem**: Maven dependency resolution fails | ||
| - **Cause**: Network issues or repository unavailable | ||
| - **Solution**: Retry the workflow; GitHub Actions will use cached dependencies if available | ||
|
|
||
| **Problem**: Checkstyle failures | ||
| - **Cause**: Code style violations | ||
| - **Solution**: Run `./mvnw spring-javaformat:apply` locally to fix formatting | ||
|
|
||
| ### Publish Failures | ||
|
|
||
| **Problem**: Authentication error deploying to Maven repository | ||
| - **Cause**: Missing or incorrect secrets | ||
| - **Solution**: Verify `ARTIFACTORY_USERNAME` and `ARTIFACTORY_PASSWORD` secrets in repository settings | ||
|
|
||
| **Problem**: "Version already exists" error | ||
| - **Cause**: Trying to publish non-SNAPSHOT version | ||
| - **Solution**: This workflow only publishes SNAPSHOT versions; use a release workflow for releases | ||
|
|
||
| ## Best Practices | ||
|
|
||
| ### For Contributors | ||
|
|
||
| 1. **Before opening PR**: Run `./mvnw clean verify` locally | ||
| 2. **Fix issues quickly**: CI failures block merging | ||
| 3. **Check test reports**: Review failed tests in Actions tab | ||
| 4. **Keep PRs focused**: Smaller PRs are easier to review and test | ||
|
|
||
| ### For Maintainers | ||
|
|
||
| 1. **Monitor workflow runs**: Check Actions tab regularly | ||
| 2. **Update secrets**: Rotate credentials periodically | ||
| 3. **Review dependencies**: Update action versions in workflows | ||
| 4. **Cache management**: Clear caches if build issues persist | ||
|
|
||
| ## Workflow Files Location | ||
|
|
||
| All workflow files are in `.github/workflows/`: | ||
| ``` | ||
| .github/workflows/ | ||
| βββ build.yml # Build & Test | ||
| βββ publish.yml # Publish to Maven | ||
| βββ codeql.yml # CodeQL security scan | ||
| βββ project.yml # Project management | ||
| ``` | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [CI README](../ci/README.md) - Detailed CI/CD documentation | ||
| - [Contributing Guide](../README.md#-contributing) - How to contribute | ||
| - [Maven Documentation](https://maven.apache.org/) - Maven reference | ||
| - [GitHub Actions Docs](https://docs.github.com/actions) - GitHub Actions reference | ||
|
|
||
| ## Getting Help | ||
|
|
||
| - Open an issue in the repository | ||
| - Check the Actions tab for workflow run logs | ||
| - Review the CI README for troubleshooting steps | ||
| - Contact maintainers via email or Discord |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # GitHub Actions workflow for Build & Tests | ||
| name: Build & Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - '[0-9]+.[0-9]+.x' | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - '[0-9]+.[0-9]+.x' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| checks: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build and Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| falkordb: | ||
| image: falkordb/falkordb:latest | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: 'maven' | ||
|
|
||
| - name: Build with Maven | ||
| run: | | ||
| ./mvnw -s settings.xml clean verify -U -B -Dcheckstyle.skip=false -Dmaven.javadoc.skip=true | ||
| echo "### Build Summary :rocket:" >> $GITHUB_STEP_SUMMARY | ||
| echo "Build completed successfully!" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Java Version: 17" >> $GITHUB_STEP_SUMMARY | ||
| echo "- FalkorDB Version: latest" >> $GITHUB_STEP_SUMMARY | ||
| env: | ||
| SDF_FALKORDB_VERSION: latest | ||
|
|
||
| - name: Upload Test Results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results | ||
| path: | | ||
| **/target/surefire-reports/*.xml | ||
| **/target/failsafe-reports/*.xml | ||
| retention-days: 7 | ||
|
|
||
| - name: Publish Test Report | ||
| if: always() | ||
| uses: dorny/test-reporter@v1 | ||
| with: | ||
| name: Maven Tests | ||
| path: '**/target/surefire-reports/*.xml,**/target/failsafe-reports/*.xml' | ||
| reporter: java-junit | ||
| fail-on-error: true | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # GitHub Actions workflow for Publishing to Maven Repository | ||
| name: Publish to Maven | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - '[0-9]+.[0-9]+.x' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: publish-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish SNAPSHOT to Maven | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | ||
|
|
||
| services: | ||
| falkordb: | ||
| image: falkordb/falkordb:latest | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: 'maven' | ||
|
|
||
| - name: Build and Deploy to Maven Repository | ||
| run: | | ||
| ./mvnw -s settings.xml clean deploy -U -B -Dcheckstyle.skip=true -Dmaven.javadoc.skip=false | ||
| echo "### Publish Summary :package:" >> $GITHUB_STEP_SUMMARY | ||
| echo "Successfully published artifacts to Maven repository!" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Version: 1.0.0-SNAPSHOT" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Branch: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | ||
| env: | ||
| SDF_FALKORDB_VERSION: latest | ||
| ARTIFACTORY_USR: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
| ARTIFACTORY_PSW: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
|
|
||
| - name: Upload Artifacts | ||
| if: success() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: maven-artifacts | ||
| path: | | ||
| target/*.jar | ||
| target/*.pom | ||
| retention-days: 30 |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium