Merge pull request #134 from jcilacad/actuator #71
This file contains hidden or 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: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
- issue-101-cicd | |
push: | |
branches: | |
- main | |
- issue-101-cicd | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
architecture: 'x64' | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml -DskipTests | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
architecture: 'x64' | |
- name: Copy env.properties | |
run: cp env.properties.example env.properties | |
- name: Run unit tests | |
run: mvn verify | |
- name: Run integration tests | |
run: mvn failsafe:integration-test | |
docker: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
architecture: 'x64' | |
- name: Copy env.properties | |
run: cp env.properties.example env.properties | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml -DskipTests | |
- name: Docker Build | |
run: docker build -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api:latest -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api:0.0.1-SNAPSHOT . | |
- name: Docker login | |
run: docker login ghcr.io -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_TOKEN }} | |
- name: Docker push | |
run: docker push ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api --all-tags | |
# sonar: | |
# runs-on: ubuntu-latest | |
# | |
# needs: test | |
# | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v2 | |
# | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v2 | |
# with: | |
# java-version: '17' | |
# distribution: 'adopt' | |
# architecture: 'x64' | |
# | |
# - name: Install SonarLint CLI | |
# run: | | |
# mkdir sonarlint-cli | |
# cd sonarlint-cli | |
# curl -L -o sonarlint-cli.zip https://binaries.sonarsource.com/Distribution/sonarlint-cli-1.0.zip | |
# ls . | |
# unzip sonarlint-cli.zip | |
# chmod +x sonarlint-cli-1.0/bin/sonarlint | |
# | |
# - name: Run SonarLint Analysis | |
# run: | | |
# ./sonarlint-cli-1.0/bin/sonarlint -Dsonar.java.binaries=target/classes -Dsonar.sources=src/main/java |