1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

Few updates in ci jobs and go.mod/dockerfile (#372)

* update go.mod to 1.20
* clean up and format ci jobs
* update go and alpine images in dockerfile

Signed-off-by: cpanato <ctadeu@gmail.com>
This commit is contained in:
Carlos Tadeu Panato Junior
2023-05-30 23:08:07 +02:00
committed by GitHub
parent 87888e9dbf
commit 926f9f3804
5 changed files with 43 additions and 11 deletions

View File

@@ -1,35 +1,47 @@
name: Build and Test name: Build and Test
on: on:
pull_request: pull_request:
jobs: jobs:
go-build: go-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Go ${{ matrix.go }} build
strategy: strategy:
matrix: matrix:
go: [ '1.20', '1.19' ] go:
name: Go ${{ matrix.go }} build - '1.20'
- '1.19'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
check-latest: true
- name: Build and test - name: Build and test
run: | run: |
go build ./... go build ./...
go test -race -coverprofile=profile.cov ./... go test -race -coverprofile=profile.cov ./...
- name: Send coverage - name: Send coverage
uses: shogo82148/actions-goveralls@v1 uses: shogo82148/actions-goveralls@v1
with: with:
path-to-profile: profile.cov path-to-profile: profile.cov
flag-name: Go-${{ matrix.go }} flag-name: Go-${{ matrix.go }}
parallel: true parallel: true
coverage: coverage:
needs: go-build needs: go-build
name: Test Coverage name: Test Coverage
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: shogo82148/actions-goveralls@v1 - uses: shogo82148/actions-goveralls@v1
with: with:

View File

@@ -1,15 +1,20 @@
name: Docker Image name: Docker Image
on: on:
push: push:
branches: [ "main" ] branches:
tags: [ "v*" ] - main
tags:
- 'v*'
pull_request: pull_request:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
@@ -25,18 +30,22 @@ jobs:
type=edge,branch=main type=edge,branch=main
flavor: | flavor: |
latest=auto latest=auto
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
with: with:
platforms: all platforms: all
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v2 uses: docker/login-action@v2
@@ -44,6 +53,7 @@ jobs:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:

View File

@@ -1,9 +1,13 @@
name: Build and Release name: Build and Release
on: on:
push: push:
branches: [ "main" ] branches:
tags: [ "v*" ] - main
tags:
- 'v*'
pull_request: pull_request:
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -11,27 +15,33 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: 1.19 go-version: '1.20'
check-latest: true
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: '16.x' node-version: '16.x'
cache: 'yarn' cache: 'yarn'
cache-dependency-path: ui/yarn.lock cache-dependency-path: ui/yarn.lock
- name: Build frontend - name: Build frontend
run: | run: |
yarn install --frozen-lockfile --non-interactive yarn install --frozen-lockfile --non-interactive
yarn run build yarn run build
working-directory: ./ui working-directory: ./ui
- name: Test build release - name: Test build release
uses: goreleaser/goreleaser-action@v4 uses: goreleaser/goreleaser-action@v4
if: "!startsWith(github.ref, 'refs/tags/v')" if: "!startsWith(github.ref, 'refs/tags/v')"
with: with:
version: latest version: latest
args: release --snapshot args: release --snapshot
- name: Build and publish release - name: Build and publish release
uses: goreleaser/goreleaser-action@v4 uses: goreleaser/goreleaser-action@v4
if: "startsWith(github.ref, 'refs/tags/v')" if: "startsWith(github.ref, 'refs/tags/v')"

View File

@@ -11,7 +11,7 @@ RUN yarn install --frozen-lockfile --non-interactive
RUN yarn run build RUN yarn run build
### Build backend ### Build backend
FROM golang:1.19-alpine3.17 as backend FROM golang:1.20-alpine3.18 as backend
RUN apk add --no-cache --virtual .build-deps g++ git make RUN apk add --no-cache --virtual .build-deps g++ git make
WORKDIR /build WORKDIR /build
COPY . . COPY . .
@@ -22,7 +22,7 @@ RUN go build -o inbucket \
-v ./cmd/inbucket -v ./cmd/inbucket
### Run in minimal image ### Run in minimal image
FROM alpine:3.17 FROM alpine:3.18
RUN apk --no-cache add tzdata RUN apk --no-cache add tzdata
WORKDIR /opt/inbucket WORKDIR /opt/inbucket
RUN mkdir bin defaults ui RUN mkdir bin defaults ui

4
go.mod
View File

@@ -1,5 +1,7 @@
module github.com/inbucket/inbucket module github.com/inbucket/inbucket
go 1.20
require ( require (
github.com/cjoudrey/gluahttp v0.0.0-20201111170219-25003d9adfa9 github.com/cjoudrey/gluahttp v0.0.0-20201111170219-25003d9adfa9
github.com/google/subcommands v1.2.0 github.com/google/subcommands v1.2.0
@@ -38,5 +40,3 @@ require (
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
go 1.18