From 738f593fd155f39f16a5d68b0f06d403686e47e6 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 3 Mar 2021 08:47:15 +0100 Subject: [PATCH] Add GitHub action for CI testing Run tests on the currently supported Go versions on Linux and macOS. Signed-off-by: Tobias Klauser --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..840e325 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + +jobs: + test: + strategy: + matrix: + go-version: [1.15, 1.16] + platform: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.platform }} + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Check formatting + if: matrix.go-version == '1.16' && matrix.platform == 'ubuntu-latest' + run: diff -u <(echo -n) <(go fmt $(go list ./...)) + + - name: Run unit tests + run: go test -v ./...