Skip to content

Commit

Permalink
Add sonar to github actions and add deploy workflow. Remove drone pip…
Browse files Browse the repository at this point in the history
…eline
  • Loading branch information
JWeston-HO committed Jun 20, 2023
1 parent b64a695 commit 31f3eb3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 175 deletions.
168 changes: 0 additions & 168 deletions .drone.yml

This file was deleted.

17 changes: 10 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
name: Build Project
name: Publish package
on:
push:
workflow_run:
workflows: [Build and analyze]
types: [completed]
branches: [main]

jobs:
build:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/setup-java@main
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Maven
run: mvn clean install
- name: Publish package
run: mvn --batch-mode deploy
env:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and analyze
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify sonar:sonar -Dsonar.projectKey=callisto-jparest -Dsonar.qualitygate.wait=true

0 comments on commit 31f3eb3

Please sign in to comment.