Build CI #639
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 CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
branches: [main] | |
schedule: | |
- cron: '0 17 * * *' | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | |
jobs: | |
build: | |
name: Build Java ${{ matrix.java }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [ '11'] | |
os: [ 'ubuntu-20.04'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- name: Cache gradle dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-caches- | |
- name: Cache gradle wrapper | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Setup java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Build with gradle | |
run: ./gradlew build checkLicense | |
- name: Link Checker | |
uses: lycheeverse/[email protected] | |
with: | |
# Check all markdown and html files in repo (default) './**/*.html' | |
args: --verbose --exclude-all-private --no-progress './**/*.md' | |
# Use json as output format (instead of markdown) | |
# format: json | |
# Use different output file path | |
# output: /tmp/foo.txt | |
# Fail action on broken links | |
fail: true | |
jobSummary: false | |
- name: Build docker | |
run: ./gradlew :java:runner:dockerBuildImageAll | |
env: | |
DOCKER_REGISTRY_URL: ${{ secrets.DOCKER_REGISTRY_URL }} | |
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_HUB_USER }} | |
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Reading docker image version | |
run: | | |
versionSnapshot=`grep 'version=' gradle.properties | sed 's/version=\([^-]*\)/\1/'` | |
echo "version_snapshot=$versionSnapshot" >> $GITHUB_ENV | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'epam/timebase-crypto-connectors:${{ env.version_snapshot }}' | |
format: 'table' | |
exit-code: '0' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH,MEDIUM' | |
- name: Run tests | |
run: ./gradlew test | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
path: build/reports/junit | |
name: Test Report | |
- name: Run Integration tests | |
# some connectors may fail, see summary to track failed connectors. | |
run: | | |
./gradlew intTest || true | |
echo "$(cat ./java/runner/build/test-reports.md)" >> $GITHUB_STEP_SUMMARY | |
- name: Upload Integration test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: integration-test-results | |
path: | | |
./java/runner/build/reports/tests/intTest | |
./java/runner/build/intTest | |
./java/runner/build/test-reports.md | |
- name: Report Tests | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: Integration Test Reports | |
path: ./java/runner/build/test-results/intTest/*.xml | |
reporter: java-junit | |
fail-on-error: false | |
only-summary: false |