Skip to content

Fix ArkAnalyzer branch (#239) #1745

Fix ArkAnalyzer branch (#239)

Fix ArkAnalyzer branch (#239) #1745

name: Build and run tests
on:
push:
branches:
- develop
- neo
pull_request:
branches:
- develop
- neo
permissions:
contents: read
checks: write
pull-requests: write
jobs:
build:
# Skip duplicate build when pushing to already existing PR
# Note: we decided NOT to skip duplicate builds,
# since we upload test results via 'EnricoMi/publish-unit-test-result-action',
# which requires 'pull_request' trigger for the bot to be able to add a comment to PR.
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
name: Run tests on JDK ${{ matrix.jdk }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jdk: [8, 11, 19]
env:
main_jdk: 8
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
distribution: 'zulu'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
# Only write to the cache for builds on the specific branches. (Default is 'main' only.)
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Build and run tests
run: ./gradlew build --stacktrace --scan
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/build/test-results/**/*.xml"
check_name: "Test results on JDK ${{ matrix.jdk }}"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
# - name: Upload test results
# uses: actions/upload-artifact@v3
# with:
# name: test-results
# path: build/test-results/
- name: Upload Gradle reports
if: (!cancelled()) && matrix.jdk == env.main_jdk
uses: actions/upload-artifact@v3
with:
name: gradle-reports
path: '**/build/reports/'
retention-days: 1
lifecycleTests:
name: Run lifecycle tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'zulu'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
# Only write to the cache for builds on the specific branches. (Default is 'main' only.)
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Build and run lifecycle tests
run: ./gradlew lifecycleTest --stacktrace --scan
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/build/test-results/**/*.xml"
check_name: "Lifecycle test results"
build-ets:
name: Build and run jacodb-ets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Set up ArkAnalyzer
run: |
git clone --depth=1 https://gitee.com/openharmony-sig/arkanalyzer
cd arkanalyzer
# checkout master on 2024-07-17
rev=a9d9fd6070fce5896d8e760ed7fd175b62b16605
git fetch --depth=1 origin $rev
git switch --detach $rev
npm install
npm run build
- name: Generate test resources for jacodb-ets module
run: ./gradlew :jacodb-ets:generateTestResources
env:
ARKANALYZER_DIR: arkanalyzer
- name: Build and run tests in jacodb-ets module
run: ./gradlew --scan :jacodb-ets:test