Skip to content

Merge branch 'develop' of https://github.com/InseeFr/Trevas into develop #808

Merge branch 'develop' of https://github.com/InseeFr/Trevas into develop

Merge branch 'develop' of https://github.com/InseeFr/Trevas into develop #808

Workflow file for this run

name: Trevas CI
on:
push:
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
name: Run Trevas tests
if: (github.repository != 'InseeFr/Trevas' &&
github.event_name == 'push') ||
(github.event.pull_request.head.repo.fork == true ||
(github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.merged == false))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "adopt"
- uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "Github",
"username": "${{ secrets.GH_PACKAGES_USERNAME }}",
"password": "${{ secrets.GH_PACKAGES_PASSWORD }}"
}]
- name: Test
run: mvn test
package:
name: Package Trevas modules
# Filter thanks to test job
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 8
distribution: "adopt"
- uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "Github",
"username": "${{ secrets.GH_PACKAGES_USERNAME }}",
"password": "${{ secrets.GH_PACKAGES_PASSWORD }}"
}]
- name: Test
run: mvn package -DskipTests
test-sonar-package:
name: Run Trevas tests with coverage & sonar checks
# Trevas main repo commit branch or merged PR
if: github.repository == 'InseeFr/Trevas' &&
(github.event_name == 'push' ||
github.event.pull_request.head.repo.fork == false ||
(github.event.pull_request.head.repo.fork == true &&
github.event.pull_request.merged == true))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "adopt"
- uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "Github",
"username": "${{ secrets.GH_PACKAGES_USERNAME }}",
"password": "${{ secrets.GH_PACKAGES_PASSWORD }}"
}]
- name: Test, package and analyze with maven & SonarCloud
run: mvn verify sonar:sonar -Pcoverage -Dsonar.projectKey=InseeFr_Trevas -Dsonar.organization=inseefr -Dsonar.host.url=https://sonarcloud.io
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish-release:
name: Publish Trevas modules on Maven
# Pre filter thanks to test-sonar-package job
if: startsWith(github.event.ref, 'refs/tags/v')
needs: test-sonar-package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v1
env:
GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- uses: s4u/[email protected]
with:
githubServer: false
servers: |
[
{
"id": "Github",
"username": "${{ secrets.GH_PACKAGES_USERNAME }}",
"password": "${{ secrets.GH_PACKAGES_PASSWORD }}"
},
{
"id": "ossrh",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}
]
- name: Publish Trevas
run: mvn -B deploy -Prelease -DskipTests=true --no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
publish-snapshot:
name: Publish Trevas modules SNAPSHOT on Github Packages
# Pre filter thanks to test-sonar-package job
if: github.ref == 'refs/heads/develop'
needs: test-sonar-package
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 8
distribution: "adopt"
- uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "Github",
"username": "${{ secrets.GH_PACKAGES_USERNAME }}",
"password": "${{ secrets.GH_PACKAGES_PASSWORD }}"
}]
- name: Publish package
run: mvn --batch-mode deploy -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.defaultLogLevel='warn'