From ab94997dd6e0feffbb1b265cc22c160ef5099f9e Mon Sep 17 00:00:00 2001 From: Jonathan Gazeley Date: Tue, 17 May 2022 21:20:18 +0100 Subject: [PATCH] Add basic tests Run release pipeline on tags --- .github/workflows/hub.yml | 13 ++++++++----- .github/workflows/test-go.yml | 16 ++++++++++++++++ .github/workflows/test-npm.yml | 22 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test-go.yml create mode 100644 .github/workflows/test-npm.yml diff --git a/.github/workflows/hub.yml b/.github/workflows/hub.yml index bd4d5c0..ddc1f11 100644 --- a/.github/workflows/hub.yml +++ b/.github/workflows/hub.yml @@ -1,8 +1,8 @@ -name: ci +name: Build docker image on: - push: - branches: master + release: + types: [published] jobs: multi: @@ -26,6 +26,9 @@ jobs: key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- + - name: Parse the git tag + id: get_tag + run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3) - name: Login to DockerHub uses: docker/login-action@v1 with: @@ -50,6 +53,6 @@ jobs: # cache-to: type=local,dest=/tmp/.buildx-cache tags: | akhilrex/hammond:latest - akhilrex/hammond:1.0.0 + akhilrex/hammond:${{ steps.get_tag.outputs.TAG }} ghcr.io/akhilrex/hammond:latest - ghcr.io/akhilrex/hammond:1.0.0 + ghcr.io/akhilrex/hammond:${{ steps.get_tag.outputs.TAG }} diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml new file mode 100644 index 0000000..343e8ad --- /dev/null +++ b/.github/workflows/test-go.yml @@ -0,0 +1,16 @@ +on: [push, pull_request] +name: Test server +jobs: + test: + strategy: + matrix: + go-version: [1.17.x, 1.18.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v3 + - run: go test ./... + working-directory: server diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml new file mode 100644 index 0000000..8b108ae --- /dev/null +++ b/.github/workflows/test-npm.yml @@ -0,0 +1,22 @@ +name: Test UI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10.x, 12.x, 14.x, 15.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + working-directory: ui + - run: npm run build --if-present + working-directory: ui + - run: npm test + working-directory: ui