mirror of https://github.com/jlelse/GoBlog
Add golangci-lint action and restructure docker action
This commit is contained in:
parent
0af387930d
commit
9c1ddbd6d7
|
@ -0,0 +1,20 @@
|
|||
name: Lint Code with golangci-lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
golangci-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.18'
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: latest
|
|
@ -1,15 +1,33 @@
|
|||
name: Build Docker images
|
||||
name: Master workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
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 ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
|
@ -22,8 +40,6 @@ jobs:
|
|||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Test
|
||||
run: DOCKER_BUILDKIT=1 docker build -t temptest . --target test
|
||||
- name: Build base image
|
||||
run: DOCKER_BUILDKIT=1 docker build -t ghcr.io/jlelse/goblog:latest . --target base
|
||||
- name: Build tools image
|
|
@ -32,10 +32,10 @@ linters:
|
|||
- gosec
|
||||
linters-settings:
|
||||
gosimple:
|
||||
go: "1.17"
|
||||
go: "1.18"
|
||||
checks: ["all"]
|
||||
gostatichcheck:
|
||||
go: "1.17"
|
||||
go: "1.18"
|
||||
checks: ["all"]
|
||||
dupl:
|
||||
threshold: 125
|
|
@ -16,10 +16,6 @@ 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