2021-03-12 19:40:50 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-10-04 17:15:29 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
2021-03-12 19:40:50 +02:00
|
|
|
|
|
|
|
- name: Set up JDK 11
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: 11
|
|
|
|
java-package: jdk+fx
|
|
|
|
server-id: dt_repository
|
|
|
|
server-username: MAVEN_USERNAME
|
|
|
|
server-password: MAVEN_CENTRAL_TOKEN
|
|
|
|
|
2021-07-23 14:43:30 +02:00
|
|
|
- name: Free disk space
|
|
|
|
run: |
|
|
|
|
sudo swapoff -a
|
|
|
|
sudo rm -f /swapfile
|
|
|
|
sudo apt clean
|
|
|
|
docker rmi $(docker image ls -aq)
|
|
|
|
df -h
|
|
|
|
|
2021-03-12 19:40:50 +02:00
|
|
|
- name: Cache maven repo
|
2021-07-23 14:43:30 +02:00
|
|
|
uses: actions/cache@v2
|
2021-03-12 19:40:50 +02:00
|
|
|
if: github.event_name == 'push' || github.event_name == 'pull_request'
|
|
|
|
with:
|
|
|
|
path: ~/.m2/repository
|
|
|
|
key: ${{ runner.os }}-maven-latest-${{ hashFiles('**/pom.xml') }}-${{ hashFiles('targets/latest/latest.target') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-maven-latest-
|
2021-10-04 15:49:53 +02:00
|
|
|
|
|
|
|
- name: Cache SonarCloud packages
|
2021-10-04 17:15:29 +02:00
|
|
|
uses: actions/cache@v2
|
2021-10-08 10:22:49 +02:00
|
|
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name
|
2021-10-04 17:15:29 +02:00
|
|
|
with:
|
|
|
|
path: ~/.sonar/cache
|
|
|
|
key: ${{ runner.os }}-sonar
|
|
|
|
restore-keys: ${{ runner.os }}-sonar
|
2021-03-12 19:40:50 +02:00
|
|
|
|
|
|
|
- name: Build with Maven
|
|
|
|
env:
|
|
|
|
MAVEN_USERNAME: ${{ secrets.P2_USER }}
|
|
|
|
MAVEN_CENTRAL_TOKEN: ${{ secrets.P2_TOKEN }}
|
2021-10-08 10:22:49 +02:00
|
|
|
# Do not start Sonar-scanning for forks
|
2021-10-08 23:09:46 +02:00
|
|
|
SONAR_PARAM: "${{ (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name) && 'org.sonarsource.scanner.maven:sonar-maven-plugin:sonar' || '' }}"
|
2021-10-04 18:19:54 +02:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
2021-10-04 15:49:53 +02:00
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
2021-03-12 19:40:50 +02:00
|
|
|
working-directory: ./
|
|
|
|
run: |
|
|
|
|
Xvfb :5 -screen 0 1280x1024x8 -fbdir /tmp &
|
|
|
|
export DISPLAY=:5
|
2021-10-08 23:09:46 +02:00
|
|
|
echo "Sonar param: \"${SONAR_PARAM}\""
|
2021-10-08 10:22:49 +02:00
|
|
|
mvn clean verify ${SONAR_PARAM} -PSDK,find-bugs -Dtycho.localArtifacts=ignore -B -V -T 1C
|
2021-03-12 19:40:50 +02:00
|
|
|
|
|
|
|
- name: Publish Test Report
|
|
|
|
uses: scacap/action-surefire-report@v1
|
2021-10-08 23:09:46 +02:00
|
|
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name
|
2021-03-12 19:40:50 +02:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Upload repo
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: v8-code-style-repository
|
|
|
|
path: repositories/com.e1c.v8codestyle.repository/target/repository/
|
|
|
|
|
|
|
|
- name: Upload SDK repo
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: v8-code-style-repository-sdk
|
|
|
|
path: repositories/com.e1c.v8codestyle.repository.sdk/target/repository/
|
|
|
|
|
|
|
|
- name: Upload JaCoCo exec data
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: jacoco
|
|
|
|
path: |
|
|
|
|
./**/target/jacoco.exec
|
|
|
|
./**/target/site/jacoco*/
|
|
|
|
|
|
|
|
- name: Upload test logs on failure
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: logs
|
|
|
|
path: ./**/.log
|