From ddd097f809da192be7afdeb6fe9b237541f113c9 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sat, 16 Apr 2022 06:22:14 +0200 Subject: [PATCH] Move testing back into Dockerfile --- .github/workflows/master.yml | 25 +++++++------------------ Dockerfile | 4 ++++ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 6f805c5..6cb148d 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -5,25 +5,8 @@ on: branches: [ master ] jobs: - test: - name: Test - runs-on: ubuntu-latest - steps: - - name: Install SQLite - run: | - sudo apt-get update - sudo apt-get -y install libsqlite3-dev build-essential - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: '1.18' - - name: Checkout - uses: actions/checkout@v3 - - name: Test - run: go test -timeout 15s -tags linux,libsqlite3,sqlite_fts5 -cover ./... docker: - name: Build Docker images - needs: [ test ] + name: Test and build Docker images runs-on: ubuntu-latest steps: - name: Checkout @@ -40,6 +23,12 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Test + uses: docker/build-push-action@v2 + with: + push: false + target: test + tags: test - name: Build base image uses: docker/build-push-action@v2 with: diff --git a/Dockerfile b/Dockerfile index fc6a1db..381fbe5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,10 @@ FROM buildbase as build RUN go build -ldflags '-w -s' -o GoBlog +FROM build as test + +RUN go test -timeout 15s -cover ./... + FROM alpine:3.15 as base WORKDIR /app