Fix examples for JDK 21 (Android Studio Ladybug) #1528
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: Code analysis | |
# Avoid duplicate builds for pull requests, allow manual trigger. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
# Minimal access by default | |
permissions: | |
contents: read | |
jobs: | |
analyze: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
# Prefer running on Ubuntu over Dart Docker image | |
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5 | |
with: | |
sdk: 3.5.2 | |
- name: Get dependencies | |
run: | | |
dart pub get --directory=benchmark | |
dart pub get --directory=generator | |
dart pub get --directory=objectbox | |
dart pub get --directory=objectbox_test | |
- name: Generate code (benchmark) | |
working-directory: benchmark | |
run: dart run build_runner build | |
- name: Generate code (objectbox_test) | |
working-directory: objectbox_test | |
run: dart run build_runner build | |
- name: Analyze Dart packages | |
run: | | |
dart analyze benchmark | |
dart analyze generator | |
dart analyze objectbox | |
dart analyze objectbox_test | |
- name: Check formatting of all packages | |
run: dart format --set-exit-if-changed --fix . | |
pana: | |
runs-on: ubuntu-24.04 | |
permissions: | |
checks: write # to publish the report | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: axel-op/dart-package-analyzer@7a6c3c66bce78d82b729a1ffef2d9458fde6c8d2 # v3 | |
id: analysis # set an id for the current step | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
relativePath: objectbox | |
# You can then use this id to retrieve the outputs in the next steps. | |
# The following step shows how to exit the workflow with an error if a score is below 100: | |
- name: Check scores | |
shell: bash | |
run: | | |
if (( ${{ steps.analysis.outputs.total }} < 100 )); then | |
echo "Expected score 130, got ${{ steps.analysis.outputs.total }}, please check the analysis report and resolve the issues" | |
exit 1 | |
fi | |
coverage: | |
runs-on: ubuntu-24.04 | |
permissions: | |
checks: write # to publish the report | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
# Prefer running on Ubuntu over Dart Docker image | |
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5 | |
with: | |
sdk: 3.5.2 | |
- name: Install coverage tools | |
run: | | |
./tool/apt-install.sh lcov | |
dart pub global activate coverage | |
- name: Prepare objectbox_test | |
working-directory: objectbox_test | |
run: | | |
dart pub get | |
dart run build_runner build | |
- name: Prepare objectbox | |
working-directory: objectbox | |
run: | | |
../install.sh | |
dart pub get | |
- name: Generate test coverage | |
working-directory: objectbox | |
run: ./tool/coverage.sh | |
- uses: devmasx/coverage-check-action@4a754f8957c6824e0a0d44bf9168fdbdf47e7e2f # v1.2.0 | |
with: | |
type: lcov | |
result_path: objectbox/coverage/lcov.info | |
min_coverage: 90 | |
token: ${{ github.token }} | |
- uses: danielpalme/ReportGenerator-GitHub-Action@b7115d212c0f7814a0cb17fb43ec36983c707ccb # v5.3.10 | |
with: | |
reports: 'objectbox/coverage/lcov.info' | |
targetdir: 'coveragereport' | |
reporttypes: 'HtmlInline' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary | |
sourcedirs: 'objectbox' | |
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: CoverageReport # Artifact name | |
path: coveragereport # Directory containing files to upload |