diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 119a531..4de07e1 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,35 +1,47 @@ name: Build and Test + on: pull_request: + jobs: go-build: runs-on: ubuntu-latest + name: Go ${{ matrix.go }} build + strategy: matrix: - go: [ '1.20', '1.19' ] - name: Go ${{ matrix.go }} build + go: + - '1.20' + - '1.19' + steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Setup Go uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} + check-latest: true + - name: Build and test run: | go build ./... go test -race -coverprofile=profile.cov ./... + - name: Send coverage uses: shogo82148/actions-goveralls@v1 with: path-to-profile: profile.cov flag-name: Go-${{ matrix.go }} parallel: true + coverage: needs: go-build name: Test Coverage runs-on: ubuntu-latest + steps: - uses: shogo82148/actions-goveralls@v1 with: diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 7494eed..017c33a 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,15 +1,20 @@ name: Docker Image + on: push: - branches: [ "main" ] - tags: [ "v*" ] + branches: + - main + tags: + - 'v*' pull_request: + jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 + - name: Docker meta id: meta uses: docker/metadata-action@v4 @@ -25,18 +30,22 @@ jobs: type=edge,branch=main flavor: | latest=auto + - name: Set up QEMU uses: docker/setup-qemu-action@v2 with: platforms: all + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@v2 @@ -44,6 +53,7 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push uses: docker/build-push-action@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c22cc2..e5c1c1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,13 @@ name: Build and Release + on: push: - branches: [ "main" ] - tags: [ "v*" ] + branches: + - main + tags: + - 'v*' pull_request: + jobs: release: runs-on: ubuntu-latest @@ -11,27 +15,33 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' + check-latest: true + - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '16.x' cache: 'yarn' cache-dependency-path: ui/yarn.lock + - name: Build frontend run: | yarn install --frozen-lockfile --non-interactive yarn run build working-directory: ./ui + - name: Test build release uses: goreleaser/goreleaser-action@v4 if: "!startsWith(github.ref, 'refs/tags/v')" with: version: latest args: release --snapshot + - name: Build and publish release uses: goreleaser/goreleaser-action@v4 if: "startsWith(github.ref, 'refs/tags/v')" diff --git a/Dockerfile b/Dockerfile index e07b2f9..22b201f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN yarn install --frozen-lockfile --non-interactive RUN yarn run build ### 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 WORKDIR /build COPY . . @@ -22,7 +22,7 @@ RUN go build -o inbucket \ -v ./cmd/inbucket ### Run in minimal image -FROM alpine:3.17 +FROM alpine:3.18 RUN apk --no-cache add tzdata WORKDIR /opt/inbucket RUN mkdir bin defaults ui diff --git a/go.mod b/go.mod index c27b6e7..876194d 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/inbucket/inbucket +go 1.20 + require ( github.com/cjoudrey/gluahttp v0.0.0-20201111170219-25003d9adfa9 github.com/google/subcommands v1.2.0 @@ -38,5 +40,3 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -go 1.18