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
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI Pipeline

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# 1. Hämta koden
- name: Checkout code
uses: actions/checkout@v5

# 2. Installera Java
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'

# 3. Cache (snabbar upp builds)
- name: Cache Maven dependencies
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven

# 4. Build + Test
- name: Build and run tests
run: mvn clean verify
env:
SPRING_DATASOURCE_URL: ${{ secrets.DB_URL }}
SPRING_DATASOURCE_USERNAME: ${{ secrets.DB_USER }}
SPRING_DATASOURCE_PASSWORD: ${{ secrets.DB_PASSWORD }}

MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }}
MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }}

# 5. Upload artifact (ONLY on main)
- name: Upload JAR artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v7
with:
name: app-${{ github.ref_name }}-${{ github.run_number }}-${{ github.sha }}
path: target/*.jar
14 changes: 14 additions & 0 deletions src/test/java/org/example/vet1177/ci_dummy_test/CiDummyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.example.vet1177.ci_dummy_test;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

public class CiDummyTest {

@Test
void shouldPass() {
assertTrue(true);
}

}