1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2026-06-12 20:47:20 +02:00
Files
v8-code-style/.github/workflows/build.yml
T
MaksimDzyuba d7fdcb5521 Update build.yml
Убрал сборку сонаром, пока не решится проблема с токеном
2026-02-05 12:05:21 +03:00

115 lines
3.3 KiB
YAML

name: Reusable build with analyze
on:
workflow_call:
inputs:
analyze:
default: false
required: false
type: boolean
secrets:
sonar_token:
required: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
PR_NUMBER: "${{ github.event_name == 'pull_request_target' && format(' -Dsonar.pullrequest.key={0}', github.event.pull_request.number) || '' }}"
PR_REF: "${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.pull_request.number) || '' }}"
steps:
- uses: actions/checkout@v4
if: inputs.analyze
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
ref: ${{ env.PR_REF }}
- uses: actions/checkout@v4
if: ${{ !inputs.analyze }}
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 17
java-package: jdk+fx
- name: Set up Maven 3.9.6
uses: s4u/setup-maven-action@v1.12.0
with:
java-version: 17
java-package: jdk+fx
- name: Free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
# docker rmi $(docker image ls -aq) || true
df -h
- name: Build with Maven
working-directory: ./
run: |
Xvfb :5 -screen 0 1280x1024x8 -fbdir /tmp &
export DISPLAY=:5
mvn clean verify -PSDK,find-bugs -Dtycho.localArtifacts=ignore -Dtycho.p2.httptransport.type=JavaUrl -B -V
# - name: Cache SonarCloud packages
# uses: actions/cache@v4
# if: inputs.analyze
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
# - name: Set up JDK 17
# if: inputs.analyze
# uses: actions/setup-java@v1
# with:
# java-version: 17
# java-package: jdk+fx
# - name: Sonar scan
# # Do not start Sonar-scanning for forks without label, and pass fork PR number directly
# if: inputs.analyze
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.sonar_token }}
# working-directory: ./
# run: mvn compile org.sonarsource.scanner.maven:sonar-maven-plugin:sonar ${{ env.PR_NUMBER }} -Dtycho.localArtifacts=ignore -B -V
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
if: inputs.analyze
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload repo
uses: actions/upload-artifact@v4
with:
name: v8-code-style-repository
path: repositories/com.e1c.v8codestyle.repository/target/repository/
- name: Upload SDK repo
uses: actions/upload-artifact@v4
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@v4
if: always()
with:
name: jacoco
path: |
./**/target/site/jacoco*/
- name: Upload test logs on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: ./**/.log