Skip to content
Merged
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
152 changes: 152 additions & 0 deletions .github/WORKFLOWS.md
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
77 changes: 77 additions & 0 deletions .github/workflows/build.yml
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

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Build & Test' step
Uses Step
uses 'dorny/test-reporter' with ref 'v1', not a pinned commit hash
with:
name: Maven Tests
path: '**/target/surefire-reports/*.xml,**/target/failsafe-reports/*.xml'
reporter: java-junit
fail-on-error: true
66 changes: 66 additions & 0 deletions .github/workflows/publish.yml
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Spring Data FalkorDB

[![Build & Test](https://github.com/FalkorDB/spring-data-falkordb/actions/workflows/build.yml/badge.svg)](https://github.com/FalkorDB/spring-data-falkordb/actions/workflows/build.yml)
[![Maven Central](https://img.shields.io/maven-central/v/org.springframework.data/spring-data-falkordb.svg)](https://search.maven.org/artifact/org.springframework.data/spring-data-falkordb)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Java Version](https://img.shields.io/badge/Java-17+-brightgreen.svg)](https://openjdk.java.net/projects/jdk/17/)
Expand Down Expand Up @@ -596,6 +597,19 @@ mvn clean compile
mvn test
```

### CI/CD

This project uses GitHub Actions for continuous integration and deployment:

- **Build & Test**: Automatically runs on all PRs and pushes to main/release branches
- Validates code with checkstyle
- Runs full test suite with FalkorDB integration tests
- Publishes test reports

- **Publish**: Automatically publishes SNAPSHOT artifacts to Maven repository on merges to main

See [ci/README.md](ci/README.md) for detailed CI/CD documentation.

### Areas Needing Help

- [ ] Query method parsing and generation
Expand Down
Loading