From f324f595f16711fd208aa7f46a676604bb6f16eb Mon Sep 17 00:00:00 2001 From: sago35 Date: Sat, 17 Sep 2022 10:52:35 +0900 Subject: [PATCH] Add .github (#5) --- .github/workflows/build.yml | 58 +++++++++++++++++++++++++++++++++++++ cmd/tinydisplay/main.go | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..df13467 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,58 @@ +name: Go package + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + + - name: Install apt dependencies + if: runner.os == 'Linux' + run: | + sudo apt install --no-install-recommends xorg-dev + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... + + - name: Build ./cmd/tinydisplay + run: | + go build -v ./cmd/tinydisplay + + - name: Publish artifact for ubuntu-latest + if: runner.os == 'Linux' + uses: actions/upload-artifact@v2 + with: + name: linux-amd64-zipped + path: | + tinydisplay + + - name: Publish artifact for windows-latest + if: runner.os == 'Windows' + uses: actions/upload-artifact@v2 + with: + name: windows-amd64-zipped + path: | + tinydisplay.exe + + - name: Publish artifact for macos-latest + if: runner.os == 'macOS' + uses: actions/upload-artifact@v2 + with: + name: macos-amd64-zipped + path: | + tinydisplay diff --git a/cmd/tinydisplay/main.go b/cmd/tinydisplay/main.go index fb966a3..5f460c8 100644 --- a/cmd/tinydisplay/main.go +++ b/cmd/tinydisplay/main.go @@ -23,7 +23,7 @@ func main() { log.Fatal(err) } if n != 2 { - log.Fatal("size format error : n != 2 (%d)", n) + log.Fatalf("size format error : n != 2 (%d)", n) } fmt.Printf("tcp:%s:%d\n", *addr, *port)