update Dockerfile #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
#Test's job | |
tests: | |
name: Unit tests | |
#Run on Ubuntu using the latest version | |
runs-on: ubuntu-latest | |
#Job's steps | |
steps: | |
#Check-out your repository under $GITHUB_WORKSPACE, so your workflow can access it | |
- uses: actions/checkout@v1 | |
#Set up JDK 17 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
#Set up Maven cache | |
- name: Cache Maven packages | |
#This action allows caching dependencies and build outputs to improve workflow execution time. | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
#Run Tests | |
- name: Run Tests | |
run: mvn -B test | |
#Sonar's Job | |
sonar: | |
#Depends on test's job | |
needs: tests | |
name: SonarCloud analysis | |
#Run on Ubuntu using the latest version | |
runs-on: ubuntu-latest | |
#Job's steps | |
steps: | |
#Check-out your repository under $GITHUB_WORKSPACE, so your workflow can access it | |
- uses: actions/checkout@v1 | |
#Set up JDK 17 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
#Set up SonarCloud cache | |
- name: Cache SonarCloud packages | |
#This action allows caching dependencies and build outputs to improve workflow execution time. | |
uses: actions/cache@v1 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
#Set up Maven cache | |
- name: Cache Maven packages | |
#This action allows caching dependencies and build outputs to improve workflow execution time. | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
#Analyze project with SonarCloud | |
- name: Analyze with SonarCloud | |
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=FarukKaradeniz_qr-generator | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
#Build's job | |
build: | |
#Depends on sonar's job | |
needs: sonar | |
name: Build | |
#Run on Ubuntu using the latest version | |
runs-on: ubuntu-latest | |
steps: | |
#Check-out your repository under $GITHUB_WORKSPACE, so your workflow can access it | |
- uses: actions/checkout@v1 | |
#Set up JDK 17 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
#Set up Maven cache | |
- name: Cache Maven packages | |
#This action allows caching dependencies and build outputs to improve workflow execution time. | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
#Build the application using Maven | |
- name: Build with Maven | |
run: mvn -B package -DskipTests --file pom.xml |