Skip to content

Commit

Permalink
Introduserer en swagger-starter prosjekt. (#28)
Browse files Browse the repository at this point in the history
* Introduserer en swagger-starter prosjekt.
* Fjerner settings.xml
* Legger i dependency management.
  • Loading branch information
mrsladek authored Apr 13, 2022
1 parent c687bfd commit 52cd7f5
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 46 deletions.
41 changes: 0 additions & 41 deletions .github/.m2/settings.xml

This file was deleted.

10 changes: 9 additions & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup maven
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: '[{ "id": "github", "name": "github", "url": "https://maven.pkg.github.com/${{ github.repository }}", "releases": { "enabled": "true" }, "snapshots": { "enabled": "false" } }]'
servers: '[{ "id": "github", "username": "${{ github.actor }}", "password": "${{ secrets.READER_TOKEN }}" }]'
output_file: settings.xml

- name: Build
run: |
echo "Verifying"
mvn verify -e --batch-mode --settings .github/.m2/settings.xml
mvn verify -e -B -s settings.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ jobs:
with:
fetch-depth: "0"

- name: Setup maven
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: '[{ "id": "github", "name": "github", "url": "https://maven.pkg.github.com/${{ github.repository }}", "releases": { "enabled": "true" }, "snapshots": { "enabled": "false" } }]'
servers: '[{ "id": "github", "username": "${{ github.actor }}", "password": "${{ secrets.READER_TOKEN }}" }]'
output_file: settings.xml

- name: Bygg
shell: bash
run: |
mvn verify -e --batch-mode --settings .github/.m2/settings.xml -DtrimStackTrace=false
mvn verify -e -B -s settings.xml -DtrimStackTrace=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ jobs:
with:
ref: 'master'

- name: Setup maven
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: '[{ "id": "github", "name": "github", "url": "https://maven.pkg.github.com/${{ github.repository }}", "releases": { "enabled": "true" }, "snapshots": { "enabled": "false" } }]'
servers: '[{ "id": "github", "username": "${{ github.actor }}", "password": "${{ secrets.READER_TOKEN }}" }]'
output_file: settings.xml

- name: Publish artifact
env:
NEW_VERSION: ${{ github.event.release.tag_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -B --settings .github/.m2/settings.xml versions:set -DnewVersion=${NEW_VERSION}
mvn -B --settings .github/.m2/settings.xml clean deploy
mvn -B -s settings.xml versions:set -DnewVersion=${NEW_VERSION}
mvn -B -s settings.xml clean deploy
31 changes: 31 additions & 0 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Snyk vulnerabilities scanning of dependencies
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:

jobs:
snyk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup maven
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: '[{ "id": "github", "name": "github", "url": "https://maven.pkg.github.com/${{ github.repository }}", "releases": { "enabled": "true" }, "snapshots": { "enabled": "false" } }]'
servers: '[{ "id": "github", "username": "${{ github.actor }}", "password": "${{ secrets.READER_TOKEN }}" }]'
output_file: settings.xml

- name: Run Snyk
uses: snyk/actions/maven@master
with:
command: monitor
args: |
--org=teamforeldrepenger
--all-projects
--configuration-attributes=usage:java-runtime
--remote-repo-url=https://github.com/${{ github.repository }}.git
-- -s settings.xml
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
11 changes: 10 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,17 @@
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
</properties>

<modules>
<module>swagger-starter</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>no.nav.foreldrepenger.felles</groupId>
<artifactId>swagger-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>no.nav.foreldrepenger</groupId>
<artifactId>konfig</artifactId>
Expand Down Expand Up @@ -384,7 +393,7 @@
<version>${logback.version}</version>
</dependency>

<!-- Swagger -->
<!-- Swagger starter-->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
Expand Down
33 changes: 33 additions & 0 deletions swagger-starter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>no.nav.foreldrepenger.felles</groupId>
<artifactId>fp-bom</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>swagger-starter</artifactId>
<packaging>pom</packaging>
<name>Foreldrepenger :: Swagger starter oppsett</name>
<description>
Starter prosjekt som includerer alle nødvendige avhengigheter til swagger-core med jaxrs2 støtte og swagger-ui.
</description>

<dependencies>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
</dependency>
</dependencies>
</project>

0 comments on commit 52cd7f5

Please sign in to comment.