| # ---------------------------------------------------------------------------- | |
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # ---------------------------------------------------------------------------- | |
| name: .NET Platform Compatibility | |
| on: | |
| push: | |
| branches: [develop, plc4net] | |
| paths: | |
| - plc4net/** | |
| - code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/** | |
| - protocols/modbus/** | |
| - protocols/s7/** | |
| - protocols/slmp/** | |
| - .editorconfig | |
| - .github/workflows/dotnet-platform.yml | |
| pull_request: | |
| branches: [develop, plc4net] | |
| paths: | |
| - plc4net/** | |
| - code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/** | |
| - protocols/modbus/** | |
| - protocols/s7/** | |
| - protocols/slmp/** | |
| - .editorconfig | |
| - .github/workflows/dotnet-platform.yml | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| parser-generation: | |
| name: Generated parser artifacts | |
| runs-on: ubuntu-slim | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.12' | |
| - name: Set up Java | |
| uses: actions/setup-java@v6 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21 | |
| - name: Cache ANTLR | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.cache/plc4x/antlr | |
| key: ${{ runner.os }}-antlr-4.13.2 | |
| - name: Verify generated parser artifacts | |
| run: python plc4net/tools/code-gen/generate_parsers.py --check | |
| protocol-model-generation: | |
| name: Generated protocol models | |
| runs-on: ubuntu-slim | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.12' | |
| - uses: actions/setup-java@v6 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21 | |
| - uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Test protocol model checks | |
| run: python -m unittest discover -s plc4net/tools/code-gen -p 'test_generate_protocol_models.py' -v | |
| - name: Verify generated protocol models | |
| run: ./mvnw -B -f plc4net/pom.xml -Pcheck-generated-code generate-sources | |
| test: | |
| name: Build and test (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore | |
| run: dotnet restore plc4net/plc4net.sln | |
| - name: Build | |
| run: dotnet build plc4net/plc4net.sln --configuration Debug --no-restore --no-incremental | |
| - name: Test | |
| run: dotnet test plc4net/plc4net.sln --configuration Debug --no-build | |
| - name: Check vulnerable dependencies | |
| run: dotnet list plc4net/plc4net.sln package --vulnerable --include-transitive |