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
36 changes: 36 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish SNAPSHOT

on:
push:
branches:
- main

permissions:
contents: read
packages: write

jobs:
publish:
runs-on: ubuntu-latest
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
cache: maven
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN

- name: Run tests
run: mvn -B verify

- name: Publish SNAPSHOT to GitHub Packages
run: mvn -B deploy -DskipTests
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
![CI](https://github.com/sMouaad/DevOps-Project/actions/workflows/ci.yml/badge.svg)
![Docker](https://github.com/sMouaad/DevOps-Project/actions/workflows/docker.yml/badge.svg)


Small NumPy-inspired Java library for ndarray operations, developed as a DevOps team project.

Repository: https://github.com/sMouaad/DevOps-Project
Expand Down Expand Up @@ -85,10 +84,38 @@ Current CI setup:
- JaCoCo coverage artifacts are uploaded from `target/site/jacoco/`.
- SonarQube analysis is triggered in the same workflow using repository secrets (`SONAR_HOST_URL` and `SONAR_TOKEN`).
- SonarQube is configured to wait for the quality gate result.
- **SNAPSHOT publishing**: On every push to `main`, if tests pass, a SNAPSHOT artifact is published to GitHub Packages.
- Publishing is blocked if line coverage drops below 70%.

### Using the SNAPSHOT

Published package coordinates:

```xml
<dependency>
<groupId>org.sadisamir</groupId>
<artifactId>ndarray-library</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
```

Add the package registry to your `pom.xml`:

```xml
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/sMouaad/DevOps-Project</url>
</repository>
</repositories>
```

Planned CI quality hardening:
Publishing workflow summary:

- Optional minimum coverage threshold gate once pipeline is stable.
- runs only on pushes to `main`
- runs `mvn verify` before deploy
- deploys with Maven `deploy` to GitHub Packages
- keeps the project version on `*-SNAPSHOT` for now

## Docker

Expand All @@ -114,11 +141,11 @@ docker run --rm ndarray-demo

Images are published to GitHub Container Registry (`ghcr.io/smouaad/devops-project`):

| Tag | Description |
|-----|-------------|
| `main` | Latest build from main branch |
| Tag | Description |
| ----------- | --------------------------------------- |
| `main` | Latest build from main branch |
| `<version>` | Semantic version (e.g., `1.0.0`, `1.0`) |
| `<sha>` | Specific commit SHA |
| `<sha>` | Specific commit SHA |

### CI/CD Pipeline

Expand Down
34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,27 @@
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.70</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>

Expand All @@ -129,6 +150,19 @@
</plugins>
</build>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/${env.GITHUB_REPOSITORY}</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/${env.GITHUB_REPOSITORY}</url>
</snapshotRepository>
</distributionManagement>

<reporting>
<plugins>
<plugin>
Expand Down
Loading