Skip to content

Commit

Permalink
chore: initialize project
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopacheco1 committed Mar 27, 2024
1 parent eaac9d3 commit 4448765
Show file tree
Hide file tree
Showing 24 changed files with 3,515 additions and 169 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ on:
types:
- completed


env:
REGISTRY: ghcr.io
# TODO Update it to your project name
IMAGE_NAME: ghcr.io/genomicdatainfrastructure/oss-project-template

IMAGE_NAME: ghcr.io/genomicdatainfrastructure/gdi-userportal-dataset-discovery-service

jobs:
ort:
strategy:
Expand All @@ -30,27 +28,34 @@ jobs:
fail-on: "issues"
run: "cache-dependencies,cache-scan-results,labels,analyzer,evaluator,advisor,reporter,upload-results"

# TODO You must review how you deliver you software and adapt the following steps.
publish-docker-image:
runs-on: ubuntu-latest
needs: ort
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
with:
java-version: "21"

- name: Checkout repository
uses: actions/checkout@v4

- name: Build project
run: mvn package -Dnative

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -62,33 +67,33 @@ jobs:
type=semver,pattern={{major}},priority=800
type=sha,priority=1000
- name: Extract SHA tag
- name: Extract last tag
id: tag
run: |
IFS=',' read -ra TAGS <<< "${{ steps.meta.outputs.tags }}"
LAST_INDEX=$((${#TAGS[@]} - 1))
echo "sha_tag=${TAGS[LAST_INDEX]}" >> $GITHUB_OUTPUT
echo "last_tag=${TAGS[LAST_INDEX]}" >> $GITHUB_OUTPUT
- name: Build Docker image for scanning
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: ${{ steps.tag.outputs.sha_tag }}
tags: ${{ steps.tag.outputs.last_tag }}
labels: ${{ steps.meta.outputs.labels }}
load: true

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.tag.outputs.sha_tag }}"
image-ref: "${{ steps.tag.outputs.last_tag }}"
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: Build and push Docker image
- name: Push Docker image
uses: docker/build-push-action@v5
with:
context: .
Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ on:

env:
REGISTRY: ghcr.io
# TODO Update it to your project name
IMAGE_NAME: ghcr.io/genomicdatainfrastructure/oss-project-template

IMAGE_NAME: ghcr.io/genomicdatainfrastructure/gdi-userportal-dataset-discovery-service

jobs:
ort:
strategy:
Expand All @@ -27,27 +26,34 @@ jobs:
fail-on: "issues"
run: "cache-dependencies,cache-scan-results,labels,analyzer,evaluator,advisor,reporter,upload-results"

# TODO You must review how you deliver you software and adapt the following steps.
publish-docker-image:
runs-on: ubuntu-latest
needs: ort
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'

- name: Checkout repository
uses: actions/checkout@v4

- name: Build project
run: mvn package -Dnative

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -59,25 +65,25 @@ jobs:
type=semver,pattern={{major}},priority=800
type=sha,priority=1000
- name: Extract SHA tag
- name: Extract last tag
id: tag
run: |
IFS=',' read -ra TAGS <<< "${{ steps.meta.outputs.tags }}"
LAST_INDEX=$((${#TAGS[@]} - 1))
echo "sha_tag=${TAGS[LAST_INDEX]}" >> $GITHUB_OUTPUT
echo "last_tag=${TAGS[LAST_INDEX]}" >> $GITHUB_OUTPUT
- name: Build Docker image for scanning
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ steps.tag.outputs.sha_tag }}
tags: ${{ steps.tag.outputs.last_tag }}
labels: ${{ steps.meta.outputs.labels }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.tag.outputs.sha_tag }}"
image-ref: "${{ steps.tag.outputs.last_tag }}"
format: "table"
exit-code: "1"
ignore-unfixed: true
Expand All @@ -91,3 +97,4 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

18 changes: 16 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ name: Run Tests

on: push

# TODO add here any kind of test you may need
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
- name: run tests
run: mvn --batch-mode --update-snapshots verify formatter:validate
- name: run sonar
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.coverage.jacoco.xmlReportPaths=./target/jacoco-report/jacoco.xml -Dsonar.organization=genomicdatainfrastructure -Dsonar.projectKey=GenomicDataInfrastructure_gdi-userportal-dataset-discovery-service
reuse:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: fsfe/reuse-action@v2
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0

#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Local environment
.env

# Plugin directory
/.quarkus/cli/plugins/
__pycache__/
venv/
Loading

0 comments on commit 4448765

Please sign in to comment.