Fix toggle reference issue #3580
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: 'Continuous integration' | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish_release: | |
| description: If this build should publish nuget packages | |
| required: true | |
| type: boolean | |
| version_suffix: | |
| description: Suffix of the version number. Can be used to create a preview package. | |
| required: false | |
| type: string | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| env: | |
| configuration: Release | |
| publish_release: ${{ github.event.inputs.publish_release }} | |
| version_suffix: ${{ github.event.inputs.version_suffix }} | |
| jobs: | |
| build_macos: | |
| name: Build (MacOS) | |
| runs-on: macos-14 | |
| if: github.event.inputs.publish_release != 'true' | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| DYLD_LIBRARY_PATH: "/opt/homebrew/lib" | |
| steps: | |
| - name: Install dependencies | |
| run: brew install cairo gdk-pixbuf gobject-introspection meson | |
| - name: Prepare git | |
| run: git config --global core.autocrlf false | |
| shell: bash | |
| - name: Checkout with submodules | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Create | |
| uses: ./.github/actions/create | |
| with: | |
| configuration: ${{ env.configuration }} | |
| source_directory: './src' | |
| script_directory: './scripts' | |
| shell: bash | |
| - name: Test | |
| uses: ./.github/actions/test | |
| with: | |
| configuration: ${{ env.configuration }} | |
| source_directory: './src' | |
| shell: bash | |
| test_categories: 'TestCategory=UnitTest | TestCategory=BindingTest' | |
| build_windows: | |
| name: Build (Windows) | |
| runs-on: windows-latest | |
| if: github.event.inputs.publish_release != 'true' | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - name: Install dependencies | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| path-type: inherit # Inherit the path so that dotnet can be found | |
| update: true | |
| msystem: UCRT64 | |
| install: >- | |
| mingw-w64-ucrt-x86_64-cairo | |
| mingw-w64-ucrt-x86_64-gcc | |
| mingw-w64-ucrt-x86_64-gdk-pixbuf2 | |
| mingw-w64-ucrt-x86_64-gobject-introspection | |
| mingw-w64-ucrt-x86_64-meson | |
| mingw-w64-ucrt-x86_64-sccache | |
| - name: Prepare git | |
| run: git config --global core.autocrlf false | |
| shell: bash | |
| - name: Checkout with submodules | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Create | |
| uses: ./.github/actions/create | |
| with: | |
| configuration: ${{ env.configuration }} | |
| source_directory: './src' | |
| script_directory: './scripts' | |
| shell: msys2 {0} | |
| - name: Test | |
| uses: ./.github/actions/test | |
| with: | |
| configuration: ${{ env.configuration }} | |
| source_directory: './src' | |
| shell: msys2 {0} | |
| test_categories: 'TestCategory=UnitTest | TestCategory=BindingTest' | |
| build_linux: | |
| name: Build (Linux) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write #Nuget trusted publishing | |
| contents: write #Create gh release | |
| container: | |
| image: fedora:latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Install dependencies | |
| run: sudo dnf -y upgrade && sudo dnf -y install meson gobject-introspection-devel git gcc glib2-devel gdk-pixbuf2 cairo-gobject libicu gh | |
| - name: Prepare git | |
| run: | | |
| git config --global core.autocrlf false | |
| git config --global --add safe.directory /__w/gir.core/gir.core | |
| - name: Checkout with submodules | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Create source archives | |
| if: env.publish_release == 'true' | |
| run: | | |
| git archive --format=zip --output=source.zip HEAD | |
| cd ./ext/gir-files | |
| git archive --format=zip --output=../../girfiles.zip HEAD | |
| - name: Create Gir.Core | |
| uses: ./.github/actions/create | |
| with: | |
| configuration: ${{ env.configuration }} | |
| source_directory: './src' | |
| script_directory: './scripts' | |
| shell: bash | |
| - name: Test | |
| uses: ./.github/actions/test | |
| with: | |
| configuration: ${{ env.configuration }} | |
| source_directory: './src' | |
| shell: bash | |
| test_categories: 'TestCategory=UnitTest | TestCategory=BindingTest | TestCategory=IntegrationTest' | |
| - name: Verify code format | |
| run: dotnet format GirCore.slnx --no-restore --verify-no-changes --exclude *.Generated.cs --exclude-diagnostics GirCore1001 GirCore1002 GirCore1003 GirCore1004 | |
| working-directory: './src' | |
| - name: Pack release version | |
| if: env.publish_release == 'true' | |
| run: dotnet pack --no-build --nologo -c $configuration --version-suffix "$version_suffix" -o ../Nuget | |
| working-directory: './src' | |
| - name: "Create GitHub release" | |
| if: env.publish_release == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| prerelease_flag="" | |
| if [ -n "$version_suffix" ]; then | |
| prerelease_flag="--prerelease" | |
| fi | |
| version=$(dotnet fsi ./scripts/GetVersion.fsx "$version_suffix") | |
| gh release create "$version" --draft --generate-notes --title "$version" $prerelease_flag ./Nuget/* | |
| gh release upload "$version" ./source.zip | |
| gh release upload "$version" ./girfiles.zip | |
| - name: NuGet login | |
| if: env.publish_release == 'true' | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Publish to nuget org | |
| if: env.publish_release == 'true' | |
| run: dotnet nuget push "*.nupkg" -k ${{steps.login.outputs.NUGET_API_KEY}} -s nuget.org | |
| working-directory: './Nuget' | |
| publish_test_results: | |
| name: Publish Test Results | |
| if: github.event.inputs.publish_release != 'true' | |
| needs: [build_linux, build_macos, build_windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts | |
| - name: Publish Unit Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: "artifacts/**/*.trx" | |
| comment_mode: 'off' |