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 ]
|
branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
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:
|
docker:
|
||||||
name: Build Docker images
|
name: Test and build Docker images
|
||||||
needs: [ test ]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -40,6 +23,12 @@ jobs:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Test
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: false
|
||||||
|
target: test
|
||||||
|
tags: test
|
||||||
- name: Build base image
|
- name: Build base image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -16,6 +16,10 @@ FROM buildbase as build
|
||||||
|
|
||||||
RUN go build -ldflags '-w -s' -o GoBlog
|
RUN go build -ldflags '-w -s' -o GoBlog
|
||||||
|
|
||||||
|
FROM build as test
|
||||||
|
|
||||||
|
RUN go test -timeout 15s -cover ./...
|
||||||
|
|
||||||
FROM alpine:3.15 as base
|
FROM alpine:3.15 as base
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
Loading…
Reference in New Issue