Skip to content

Error logging if subcomponent is of primitive type #1377

Error logging if subcomponent is of primitive type

Error logging if subcomponent is of primitive type #1377

Workflow file for this run

# (c) https://github.com/MontiCore/monticore
name: Gradle Test & Build
concurrency: # run this test workflow only once per "branch"
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push: # run this test pipeline on every push
paths-ignore:
- "**.md"
pull_request: # and pull request (Note: We can skip pull request events IFF the PR is not done from a fork)
paths-ignore:
- "**.md"
repository_dispatch: # and on request of upstream projects
types: [ trigger_after_upstream_deploy ]
env:
GRADLE_VERSION: 7.6 # Gradle version used
GRADLE_CLI_OPTS: "-Pci --build-cache " # CLI option passed to Gradle
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: "test-cache-${{ github.head_ref }}.${{ github.sha }}"
permissions:
contents: read # This action may run somewhat unsafe code
checks: write
jobs:
build-generator:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name # do not run duplicate jobs on PRs
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Build the monticore-generator
run: gradle build -p monticore-generator ${{env.GRADLE_CLI_OPTS}}
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
build-mc:
runs-on: ubuntu-latest
needs: build-generator
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Build monticore (buildMC)
run: gradle buildMC ${{env.GRADLE_CLI_OPTS}} -PgenTR=true -PgenEMF=true -PgenTagging=true
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# first set of experiments from the handbook
test-01-experiments:
runs-on: ubuntu-latest
needs: build-mc
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Test 01.experiments
run: gradle build test -p monticore-test/01.experiments ${{env.GRADLE_CLI_OPTS}} -PgenEMF=true
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# second set of experiments from the handbook
test-02-experiments:
runs-on: ubuntu-latest
needs: build-mc
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Test 02.experiments
run: gradle build test -p monticore-test/02.experiments ${{env.GRADLE_CLI_OPTS}} -PgenEMF=true
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# test integration tests from the it project
test-it:
runs-on: ubuntu-latest
needs: build-mc
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Test monticore-test/it
run: gradle build test -p monticore-test/it ${{env.GRADLE_CLI_OPTS}}
- name: Checking that all file handles in the target folder are closed
run: if pgrep java | xargs -i ls -la /proc/{}/fd | grep "monticore-test/it/target/"; then echo "Found open file handles!"; exit 1; else echo "No open file handles."; exit 0; fi
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# test integration tests from the "it" project, using the emf profile
test-it-emf:
runs-on: ubuntu-latest
needs: build-mc
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Test monticore-test/it with emf profile
run: gradle build test -p monticore-test/it ${{env.GRADLE_CLI_OPTS}} -PbuildProfile=emf -PgenEMF=true
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# Grammar integration tests
test-grammar-it:
runs-on: ubuntu-latest
needs: build-mc
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Test monticore-grammar-it
run: gradle build test -p monticore-test/monticore-grammar-it ${{env.GRADLE_CLI_OPTS}} -PgenEMF=true
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# Transformation tests
test-montitrans:
runs-on: ubuntu-latest
needs: build-mc
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Test monticore-grammar-it
run: gradle build test -p monticore-test/montitrans ${{env.GRADLE_CLI_OPTS}} -PgenTR=true
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# Look ahead in time to check if this would break the next MC release
test-for-breaking-changes:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name ) && github.ref_name != github.event.repository.default_branch # do not run duplicate jobs on PRs or on dev branch
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: ${{env.GRADLE_VERSION}}
- name: Setup git
run: git config --global user.email "[email protected]" && git config --global user.name "ci"
- name: Apply patches to look into the future
run: sh ./prepare-next-release/applyPatches.sh
- name: Build a subset of the monticore project
run: gradle monticore-generator:build monticore-grammar:build monticore-test:check ${{env.GRADLE_CLI_OPTS}}
- name: Publish Test Report
uses: mikepenz/action-junit-report@a451de5ac1ff45e46508b6150cb4f51a287d0309
if: always() # always run even if the previous step fails
with:
report_paths: '**/target/test-results/test/TEST-*.xml'
# Run the MontiVerse pipeline (tests this change on a suite of projects)
trigger-montiverse:
if: github.event_name == 'pull_request' # only run on PRs
uses: ./.github/workflows/call_montiverse_branch.yml
with:
project: "MONTICORE"
permissions: # allow this action to give feedback on its checks
pull-requests: write
statuses: write
secrets: inherit
# Check for duplicate error codes (starting with '"0x') and incorrect error codes (not 5 hex chars after the 0x)
check-error-codes:
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Check for duplicate and invalid error codes
run: |
grep -riEno "\"(0x[0-9a-zA-Z]{3,})" --include="*.java" --exclude-dir="test" . | grep -ivE "\"0x[0-9A-F]{3,}" | awk -F ":" '{print "::warning file="$1",line="$2",title=ErrorCodeInvalid::Invalid error code "substr($3,2)" (" $1 ":" $2 ")";}'
grep -riEno "\"(0x[0-9a-zA-Z]{3,})" --include="*.java" --exclude-dir="test" . | awk -F '\"' '{if($2 in x){if(x[$2]) print x[$2]; print $1substr($2,1);x[$2]=""} else x[$2]=$1substr($2,1)}' | awk -F ":" '{print "::warning file="$1",line="$2",title=ErrorCodeDuplicate::Duplicate error code "$3" (" $1 ":" $2 ")";}'
# TODO: FIX to specific version instead of @v3
# TODO: check-links
# TODO: checkMLCs