mirror of https://github.com/jlelse/GoBlog
Move testing back into Dockerfile
This commit is contained in:
parent
921212dacf
commit
ddd097f809
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue