require go 1.24 minimum #6
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 and Test | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| env: | |
| GO_VERSION: '1.24' | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libgl1-mesa-dev \ | |
| libxcursor-dev \ | |
| libxrandr-dev \ | |
| libxinerama-dev \ | |
| libxi-dev \ | |
| libxxf86vm-dev \ | |
| libasound2-dev \ | |
| libxcb-util-dev \ | |
| libxcb-icccm4-dev \ | |
| libxcb-xfixes0-dev \ | |
| pkg-config | |
| - name: Add static library replacements | |
| run: | | |
| go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600 | |
| go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.5.131 | |
| - name: Run tests | |
| run: go test -v ./... | |
| build-linux: | |
| name: Build Linux | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libgl1-mesa-dev \ | |
| libxcursor-dev \ | |
| libxrandr-dev \ | |
| libxinerama-dev \ | |
| libxi-dev \ | |
| libxxf86vm-dev \ | |
| libasound2-dev \ | |
| libxcb-util-dev \ | |
| libxcb-icccm4-dev \ | |
| libxcb-xfixes0-dev \ | |
| pkg-config | |
| - name: Add static library replacements | |
| run: | | |
| go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600 | |
| go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.5.131 | |
| - name: Build | |
| run: | | |
| CGO_ENABLED=1 go build -v -ldflags="-s -w" -o shells-go-linux-amd64 . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shells-go-linux-amd64 | |
| path: shells-go-linux-amd64 | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| needs: test | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup MSYS2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-go | |
| mingw-w64-x86_64-pkg-config | |
| - name: Add static library replacements | |
| run: | | |
| go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600 | |
| go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.5.131 | |
| - name: Build | |
| run: | | |
| export CGO_ENABLED=1 | |
| go build -v -ldflags="-s -w" -o shells-go-windows-amd64.exe . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shells-go-windows-amd64 | |
| path: shells-go-windows-amd64.exe | |
| build-macos-intel: | |
| name: Build macOS Intel | |
| runs-on: macos-15-intel | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Add static library replacements | |
| run: | | |
| go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600 | |
| go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.5.131 | |
| - name: Build | |
| run: | | |
| CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w" -o shells-go-darwin-amd64 . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shells-go-darwin-amd64 | |
| path: shells-go-darwin-amd64 | |
| build-macos-arm: | |
| name: Build macOS ARM + Universal Binary | |
| runs-on: macos-latest | |
| needs: [test, build-macos-intel] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Add static library replacements | |
| run: | | |
| go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600 | |
| go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.5.131 | |
| - name: Build ARM64 | |
| run: | | |
| CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w" -o shells-go-darwin-arm64 . | |
| - name: Download Intel binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: shells-go-darwin-amd64 | |
| - name: Create Universal Binary | |
| run: | | |
| lipo -create -output shells-go-darwin-universal shells-go-darwin-amd64 shells-go-darwin-arm64 | |
| file shells-go-darwin-universal | |
| - name: Upload ARM64 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shells-go-darwin-arm64 | |
| path: shells-go-darwin-arm64 | |
| - name: Upload Universal Binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shells-go-darwin-universal | |
| path: shells-go-darwin-universal |