From 667e4702b8ed355c94ef80162756e58852f85976 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 20 Aug 2022 20:44:43 +0200 Subject: [PATCH] ci: add test jobs Signed-off-by: CrazyMax --- .github/workflows/build.yml | 66 ++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd111c7..242f70b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,10 +11,71 @@ on: env: DESTDIR: ./bin + GO_VERSION: 1.16.7 jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-20.04 + - macOS-11 + - windows-2022 + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + - + name: Install deps + if: ${{ matrix.os == 'ubuntu-20.04' }} + run: | + sudo apt-get update + sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass + - + name: Test + run: | + go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./... + go tool cover -func=./coverage.txt + shell: bash + - + name: Upload coverage + uses: codecov/codecov-action@v3 + with: + file: ./coverage.txt + + test-sandboxed: + runs-on: ubuntu-20.04 + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Test + uses: docker/bake-action@v2 + with: + targets: test + set: | + *.cache-from=type=gha,scope=test + *.cache-to=type=gha,scope=test,mode=max + - + name: Upload coverage + uses: codecov/codecov-action@v3 + with: + file: ${{ env.DESTDIR }}//coverage.txt + build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout @@ -30,6 +91,9 @@ jobs: uses: docker/bake-action@v2 with: targets: binaries + set: | + *.cache-from=type=gha,scope=build + *.cache-to=type=gha,scope=build,mode=max - name: Move artifacts run: |