Skip to content

fixes tests

fixes tests #3

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
outputs:
project_version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Extract Maven Version
id: get_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected project version: $VERSION"
- name: Build and Verify with Maven
run: mvn clean verify
# Upload the built jar as an artifact to be used by the docker job
# The artifact name includes the version for better traceability
- name: Upload Artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: memory-mcp-server-${{ steps.get_version.outputs.version }}
path: target/*.jar
retention-days: 1
docker-publish:
name: Publish Docker Image
needs: build-and-test
runs-on: ubuntu-latest
# Only run on push to main branch (after merge)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: memory-mcp-server-${{ needs.build-and-test.outputs.project_version }}
path: target
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
# Push with multiple tags: latest, commit SHA, and the maven version
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/memory-mcp-server:latest
${{ secrets.DOCKERHUB_USERNAME }}/memory-mcp-server:${{ github.sha }}
${{ secrets.DOCKERHUB_USERNAME }}/memory-mcp-server:${{ needs.build-and-test.outputs.project_version }}