name: Go on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: name: Build runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest output: bin/engarde-importer ldflags: "" - os: windows-2022 output: bin/engarde-importer.exe ldflags: "-H=windowsgui -extldflags=-static" env: GOARCH: amd64 steps: - name: Set up Go 1.17 uses: actions/setup-go@v2 with: go-version: 1.17 id: go - id: go-cache-paths run: | echo "::set-output name=go-build::$(go env GOCACHE)" echo "::set-output name=go-mod::$(go env GOMODCACHE)" - if: startsWith(matrix.os,'ubuntu') name: Install Dependencies run: | sudo apt-get --allow-releaseinfo-change update sudo apt-get install -y libglfw3-dev libfreetype6-dev xorg-dev - name: Go Cache uses: actions/cache@v2 with: path: | ${{ steps.go-cache-paths.outputs.go-build }} ${{ steps.go-cache-paths.outputs.go-mod }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Checkout uses: actions/checkout@v2 - name: Build run: go build -v ./... - name: Test run: go test -v ./... - name: Vet run: go vet ./... - name: Release Build run: go build -ldflags '-s -w ${{ matrix.ldflags }}' -o ${{ matrix.output }} - name: Upload Release uses: ColinPitrat/update-release@v1.0.1 id: update-release with: token: ${{ secrets.GITHUB_TOKEN }} files: ${{ matrix.output }} tag: release