Fix macOS SIGTERM CPU spin and shield restart state loss #297
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: Build Hydra | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - '**.md' | |
| concurrency: | |
| group: build-hydra | |
| cancel-in-progress: false | |
| jobs: | |
| version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Determine version | |
| id: version | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| if [ "${{ github.event_name }}" == "push" ]; then | |
| latest=$(gh release list --limit 1 --json tagName --jq '.[0].tagName // empty') | |
| patch=$(echo "$latest" | sed 's/^v\?0\.1\.//') | |
| echo "version=0.1.$((patch + 1))" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version=0.1.0" >> "$GITHUB_OUTPUT" | |
| fi | |
| test-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore | |
| run: dotnet restore Hydra.sln | |
| - name: Test | |
| run: dotnet test Hydra.sln --no-restore | |
| test-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore | |
| run: dotnet restore Hydra.sln | |
| - name: Test | |
| run: dotnet test Hydra.sln --no-restore | |
| build: | |
| runs-on: macos-latest | |
| needs: [version] | |
| strategy: | |
| matrix: | |
| rid: [osx-arm64, win-x64, linux-x64, linux-arm64] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Publish Hydra (${{ matrix.rid }}) | |
| run: dotnet publish Hydra --runtime ${{ matrix.rid }} --self-contained -p:Version=${{ needs.version.outputs.version }} | |
| - name: Package artifact | |
| run: | | |
| cd Hydra/bin/Release/net10.0/${{ matrix.rid }}/publish | |
| tar czf ${{ github.workspace }}/hydra-${{ matrix.rid }}.tar.gz --exclude='*.pdb' . | |
| if [[ "${{ matrix.rid }}" == win-* ]]; then | |
| zip -r ${{ github.workspace }}/hydra-${{ matrix.rid }}.zip . -x '*.pdb' | |
| fi | |
| - name: Upload artifact | |
| if: github.event_name == 'push' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: hydra-${{ matrix.rid }} | |
| path: hydra-${{ matrix.rid }}.* | |
| release: | |
| needs: [build, test-linux, test-windows, version] | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| gh release create "v${{ needs.version.outputs.version }}" \ | |
| --title "Hydra ${{ needs.version.outputs.version }}" \ | |
| --generate-notes \ | |
| hydra-osx-arm64/hydra-osx-arm64.tar.gz \ | |
| hydra-win-x64/hydra-win-x64.tar.gz \ | |
| hydra-win-x64/hydra-win-x64.zip \ | |
| hydra-linux-x64/hydra-linux-x64.tar.gz \ | |
| hydra-linux-arm64/hydra-linux-arm64.tar.gz | |
| - name: Prune old releases (keep last 5) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| gh release list --json tagName --jq '.[5:][].tagName' | while read -r tag; do | |
| gh release delete "$tag" --yes --cleanup-tag | |
| done |