Fix for each is valid coco for super types of iterable #329
This file contains hidden or 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
| # (c) https://github.com/MontiCore/monticore | |
| name: Build and Package | |
| concurrency: # run this test workflow only once per branch | |
| group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| cache: gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| gradle-version: 8.5 | |
| - name: Build with Gradle | |
| run: gradle shadowjar :tooling:language-server:build :tooling:montiarc-intellij-plugin:build -PenableLanguageServer | |
| - name: Extract version name | |
| shell: bash | |
| run: | | |
| echo "version=$(grep -Eo '[0-9]\.[0-9]+\.[0-9]+' build-logic/src/main/kotlin/montiarc/build/BuildConstants.kt)" >> $GITHUB_OUTPUT | |
| echo "full_version=$(grep -Eo '[0-9]\.[0-9]+\.[0-9]+(-[a-zA-Z]+)?' build-logic/src/main/kotlin/montiarc/build/BuildConstants.kt)" >> $GITHUB_OUTPUT | |
| id: extract_version | |
| - name: Rename and move artifacts | |
| run: | | |
| mkdir dist | |
| mv tooling/ma2jsim-cli/build/libs/MontiArc.jar dist/MontiArc-${{ steps.extract_version.outputs.version }}.jar | |
| mv tooling/language-server/build/generated-sources/MontiArcWithCD4A/plugins/montiarcwithcd4a-vscode-plugin/montiarc-${{ steps.extract_version.outputs.full_version }}.vsix dist/MontiArc-${{ steps.extract_version.outputs.version }}.vsix | |
| mv tooling/montiarc-intellij-plugin/build/distributions/montiarc-intellij-plugin-${{ steps.extract_version.outputs.full_version }}.zip dist/MontiArc-Intellij-Plugin-${{ steps.extract_version.outputs.version }}.zip | |
| # Upload the build. | |
| - name: 'Upload Build Artifact' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MontiArc-${{ steps.extract_version.outputs.version }}.jar | |
| path: ./dist/MontiArc-${{ steps.extract_version.outputs.version }}.jar | |
| if-no-files-found: error | |
| - name: 'Upload Extension Artifact' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MontiArc-${{ steps.extract_version.outputs.version }}.vsix | |
| path: dist/MontiArc-${{ steps.extract_version.outputs.version }}.vsix | |
| if-no-files-found: warn | |
| - name: 'Upload Intellij Artifact' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MontiArc-Intellij-Plugin-${{ steps.extract_version.outputs.version }}.zip | |
| path: dist/MontiArc-Intellij-Plugin-${{ steps.extract_version.outputs.version }}.zip | |
| if-no-files-found: warn | |
| package: | |
| name: Package ${{ matrix.target }} build | |
| runs-on: ${{ matrix.os }} | |
| container: ${{ matrix.container }} | |
| needs: build | |
| strategy: | |
| matrix: | |
| target: [ macOS, Windows, Linux, Debian, Fedora ] | |
| include: | |
| - os: macos-latest | |
| target: macOS | |
| asset_extension: .pkg | |
| package_settings: -t pkg --icon docs/assets/images/icon.png --about-url "https://monticore.github.io/montiarc" --resource-dir tooling/ma2jsim-cli/jpackage/macos | |
| - os: windows-latest | |
| target: Windows | |
| asset_extension: .exe | |
| package_settings: --win-console --win-dir-chooser --icon docs/assets/images/icon.ico --about-url "https://monticore.github.io/montiarc" --win-upgrade-uuid 8239b244-9b64-4da7-8697-8aefecdc25b4 --resource-dir tooling/ma2jsim-cli/jpackage/windows --verbose | |
| - os: ubuntu-latest | |
| target: Linux | |
| asset_extension: -Linux.tar.xz | |
| package_settings: -t app-image --icon docs/assets/images/icon.png | |
| - os: ubuntu-latest | |
| target: Debian | |
| asset_extension: .deb | |
| package_settings: -t deb --linux-deb-maintainer "SE at RWTH" --icon docs/assets/images/icon.png --about-url "https://monticore.github.io/montiarc" | |
| - os: ubuntu-latest | |
| container: | |
| image: fedora:latest | |
| options: --group-add 135 | |
| target: Fedora | |
| asset_extension: .rpm | |
| package_settings: -t rpm --icon docs/assets/images/icon.png --about-url "https://monticore.github.io/montiarc" | |
| # Disable fail-fast as we want results from all even if one fails. | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| # Setup Dependencies | |
| - name: Add msbuild to PATH | |
| if: matrix.target == 'Windows' | |
| uses: microsoft/setup-msbuild@v1.1 | |
| - name: Install WiX | |
| if: matrix.target == 'Windows' | |
| run: dotnet tool install --global wix | |
| - name: Add WiX extensions | |
| if: matrix.target == 'Windows' | |
| run: wix extension add -g WixToolset.UI.wixext WixToolset.Util.wixext | |
| - name: Setup Java | |
| if: matrix.target == 'Windows' | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: oracle | |
| # Use latest Java version for newest jpackage | |
| java-version: 25 | |
| - name: Install Fedora dependencies | |
| if: matrix.target == 'Fedora' | |
| run: | | |
| sudo dnf update -y | |
| sudo dnf install -y rpm-build java-latest-openjdk-devel java-latest-openjdk-static-libs java-latest-openjdk-jmods | |
| - name: Install Linux dependencies | |
| if: matrix.target == 'Linux' || matrix.target == 'Debian' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y fakeroot | |
| # Package | |
| - name: Extract version name | |
| shell: bash | |
| run: echo "version=$(grep -Eo '[0-9]\.[0-9]+\.[0-9]+' build-logic/src/main/kotlin/montiarc/build/BuildConstants.kt)" >> $GITHUB_OUTPUT | |
| id: extract_version | |
| - name: Download Jar | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: MontiArc-${{ steps.extract_version.outputs.version }}.jar | |
| path: dist/ | |
| - name: Package | |
| if: matrix.target != 'Jar' | |
| run: jpackage -i dist/ --main-jar MontiArc-${{ steps.extract_version.outputs.version }}.jar --name MontiArc --app-version ${{ steps.extract_version.outputs.version }} --vendor "SE at RWTH Aachen" --copyright "(c) https://github.com/MontiCore/monticore" ${{ matrix.package_settings }} | |
| # Rename and compress | |
| - name: Compress build for Linux | |
| if: matrix.target == 'Linux' | |
| run: tar czf MontiArc-${{ steps.extract_version.outputs.version }}${{ matrix.asset_extension }} MontiArc | |
| - name: Rename for Debian | |
| if: matrix.target == 'Debian' | |
| run: mv montiarc_${{ steps.extract_version.outputs.version }}-1_amd64${{ matrix.asset_extension }} MontiArc-${{ steps.extract_version.outputs.version }}${{ matrix.asset_extension }} | |
| - name: Rename for Fedora | |
| if: matrix.target == 'Fedora' | |
| run: mv montiarc-${{ steps.extract_version.outputs.version }}-1.x86_64${{ matrix.asset_extension }} MontiArc-${{ steps.extract_version.outputs.version }}${{ matrix.asset_extension }} | |
| - name: Package Jar | |
| if: matrix.target == 'Jar' | |
| run: mv generators/ma2jsim/build/libs/MontiArcSimulator.jar MontiArc-${{ steps.extract_version.outputs.version }}.jar | |
| # Upload the build. | |
| - name: 'Upload Artifact' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MontiArc-${{ steps.extract_version.outputs.version }}${{ matrix.asset_extension }} | |
| path: ./MontiArc-${{ steps.extract_version.outputs.version }}${{ matrix.asset_extension }} | |
| retention-days: 7 | |
| snapshot-release: | |
| name: Release SNAPSHOT | |
| runs-on: ubuntu-latest | |
| if: github.repository_owner == 'MontiCore' && github.event_name == 'push' && github.ref == 'refs/heads/dev' | |
| needs: package | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version name | |
| shell: bash | |
| run: echo "version=$(grep -Eo '[0-9]\.[0-9]+\.[0-9]+' build-logic/src/main/kotlin/montiarc/build/BuildConstants.kt)" >> $GITHUB_OUTPUT | |
| id: extract_version | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| # GitHub Releases require a tag | |
| - name: Delete release if exist then create release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release view "snapshot" && gh release delete "snapshot" -y --cleanup-tag | |
| gh release create "snapshot" "./dist/*" -p -t "MontiArc ${{ steps.extract_version.outputs.version }} SNAPSHOT" --generate-notes | |
| tag-release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| if: github.repository_owner == 'MontiCore' && startsWith(github.ref, 'refs/tags/') | |
| needs: package | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version name | |
| shell: bash | |
| run: echo "version=$(grep -Eo '[0-9]\.[0-9]+\.[0-9]+' build-logic/src/main/kotlin/montiarc/build/BuildConstants.kt)" >> $GITHUB_OUTPUT | |
| id: extract_version | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Create release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "${{ github.ref_name }}" "./dist/*" --verify-tag -d -t "MontiArc ${{ steps.extract_version.outputs.version }}" --generate-notes |