name: Push on: push: branches: - develop pull_request: branches: - develop jobs: build-and-test: name: Build and Test runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-22.04] go: ["1.20.10", "1.21.3"] goos: [linux] goarch: [amd64, arm64] steps: - name: Setup Go uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - name: Code checkout uses: actions/checkout@v4 - name: go mod download env: CGO_ENABLED: 0 run: | go mod download - name: Build env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 SRC_PATH: github.com/pterodactyl/wings run: | go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o dist/wings ${SRC_PATH} go build -v -trimpath -ldflags="-X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o dist/wings_debug ${SRC_PATH} chmod 755 dist/* - name: go test if: ${{ matrix.goarch == 'amd64' }} env: CGO_ENABLED: 0 run: | go test $(go list ./...) - name: go test -race if: ${{ matrix.goarch == 'amd64' }} env: CGO_ENABLED: 1 run: | go test -race $(go list ./...) - name: Upload Release Artifact uses: actions/upload-artifact@v3 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} with: name: wings_linux_${{ matrix.goarch }} path: dist/wings - name: Upload Debug Artifact uses: actions/upload-artifact@v3 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} with: name: wings_linux_${{ matrix.goarch }}_debug path: dist/wings_debug