Skip to content

CD2JavaGenCoCos for the CDGenTool #677

CD2JavaGenCoCos for the CDGenTool

CD2JavaGenCoCos for the CDGenTool #677

Workflow file for this run

# (c) https://github.com/MontiCore/monticore
name: Test Proposed Changes
concurrency: # run this test workflow only once per "branch"
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push: # run this pipeline on every push
paths-ignore:
- "*.md" # do not run this pipeline if the only change was to markdown files
branches-ignore: [ "dev" ] # Do not run this on the default branch
pull_request: # run on (remote) pull requests
types: [opened, synchronize]
env:
GRADLE_VERSION: 7.6 # Gradle version used
GRADLE_CLI_OPTS: "-Pci --build-cache -PgenTR=false -PgenTagging=true --refresh-dependencies " # CLI options passed to Gradle
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: "test-cache-${{ github.head_ref }}.${{ github.sha }}"
permissions:
contents: read
jobs:
build:
# do not run on pull requests in the same project (only on PRs from external sources)
if: ${{github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
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: Gradle build
run: gradle build ${{env.GRADLE_CLI_OPTS}}
- name: Upload Test Report
uses: actions/upload-artifact@v4
if: always() # always run even if the previous step fails
with:
name: junit-test-results
path: '**/target/test-results/*/TEST-*.xml'
retention-days: 1
# Run the MontiVerse pipeline (tests this change on a suite of projects)
trigger-montiverse:
# do not run on PRs. Forked PRs are handled via report_proposed_changes[workflow_run].
if: ${{github.event_name == 'push'}}
needs: [ build ]
uses: MontiCore/monticore/.github/workflows/call_montiverse_branch.yml@dev
with:
project: "CD4A"
permissions: # allow this action to give feedback on its checks
pull-requests: 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:
# do not run on pull requests in the same project (only on PRs from external sources)
if: ${{github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
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="substr($1,3)",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="substr($1,3)",line="$2",title=ErrorCodeDuplicate::Duplicate error code "$3" (" $1 ":" $2 ")";}'