build: emit stable assembly version metadata for 1.x #394
Workflow file for this run
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
| name: gregCore CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'refactor/**' | |
| - 'compat/**' | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: gregcore-ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| profiles: | |
| name: Validate compatibility profiles | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - run: python scripts/validate_compat_profiles.py | |
| hooks-v2: | |
| name: Validate hook manifest v2 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - run: python scripts/validate_hook_manifest.py framework/game_hooks.v2.json | |
| hooks-legacy: | |
| name: Validate legacy hook JSON syntax | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - run: python -m json.tool game_hooks.json > /dev/null | |
| build: | |
| name: Build and test (${{ matrix.label }}) | |
| needs: [profiles, hooks-v2, hooks-legacy] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| label: windows-x64 | |
| - os: ubuntu-latest | |
| label: linux-x64 | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CI: 'true' | |
| DeployToGameOnBuild: 'false' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 6.0.x | |
| - name: Restore solution | |
| run: dotnet restore gregCore.sln --verbosity minimal | |
| - name: Build solution | |
| run: dotnet build gregCore.sln -c Release --no-restore -p:CI=true -p:DeployToGameOnBuild=false --verbosity minimal | |
| - name: Run managed tests | |
| run: dotnet test tests/gregCore.Tests.csproj -c Release --no-build --logger "trx;LogFileName=gregCore-${{ matrix.label }}.trx" | |
| - name: Stage MelonLoader artifact | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| VERSION="$(tr -d '[:space:]' < VERSION)" | |
| OUT="dist/gregCore-${VERSION}-melonloader-${{ matrix.label }}" | |
| mkdir -p "$OUT/Mods/gregCore" | |
| cp bin/Release/net6.0/gregCore.dll "$OUT/Mods/gregCore/" | |
| cp game_hooks.json "$OUT/Mods/gregCore/" | |
| cp framework/game_hooks.v2.json "$OUT/Mods/gregCore/" | |
| cp framework/game_hooks.schema.v2.json "$OUT/Mods/gregCore/" | |
| cp -R compat "$OUT/Mods/gregCore/compat" | |
| cp README.md CHANGELOG.md "$OUT/" | |
| cd dist | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| powershell -NoProfile -Command "Compress-Archive -Path 'gregCore-${VERSION}-melonloader-${{ matrix.label }}/*' -DestinationPath 'gregCore-${VERSION}-melonloader-${{ matrix.label }}.zip'" | |
| else | |
| zip -qr "gregCore-${VERSION}-melonloader-${{ matrix.label }}.zip" "gregCore-${VERSION}-melonloader-${{ matrix.label }}" | |
| fi | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gregCore-${{ matrix.label }} | |
| path: dist/*.zip | |
| if-no-files-found: error | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.label }} | |
| path: '**/*.trx' | |
| if-no-files-found: ignore | |
| public-api: | |
| name: Public API compatibility baseline | |
| needs: [profiles, hooks-v2] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 6.0.x | |
| - name: Ensure shipped API baseline exists | |
| run: test -s eng/PublicApi.Shipped.txt | |
| - name: Build stable contract projects | |
| run: | | |
| dotnet build src/gregCore.Abstractions/gregCore.Abstractions.csproj -c Release -p:CI=true --verbosity minimal | |
| dotnet build src/gregCore.SDK/gregCore.SDK.csproj -c Release -p:CI=true --verbosity minimal |