-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (73 loc) · 2.74 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: build and test
on:
push:
paths-ignore:
- '**/README.md'
- '**/README_DEV.md'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@latest
- uses: actions/setup-go@v3
with:
go-version: '>=1.18.0'
# - name: Install dependencies
# run: go get -u golang.org/x/lint/golint
# - name: Run vet and lint
# run: |
# go vet .
# golint -set_exit_status=1 .
- run: go build
#- run: go test -timeout 120s ./...
- run: go test -race -coverprofile=coverage.out -covermode=atomic -timeout 120s ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
publish-container:
runs-on: ubuntu-latest
needs: build-and-test
if: github.ref == 'refs/heads/main'
strategy:
matrix:
variant: [{dockerfile: Dockerfile, tagSuffix: ''}, {dockerfile: Dockerfile.unprivileged, tagSuffix: '-unprivileged'}, {dockerfile: Dockerfile.withoutPlayground, tagSuffix: '-without-playground'}]
steps:
- name: Set version to env
run: |
echo "VERSION=$(date +'%Y.%-m.%-d.%-H%M')" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
submodules: recursive
# - run: git submodule update --init
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
platforms: linux/amd64, linux/arm64
file: ./${{ matrix.variant.dockerfile }}
context: ./
tags: |
lucasgaitzsch/pdf-turtle:latest${{ matrix.variant.tagSuffix }}
lucasgaitzsch/pdf-turtle:v${{ env.VERSION }}${{ matrix.variant.tagSuffix }}
ghcr.io/${{ github.repository }}:latest${{ matrix.variant.tagSuffix }}
ghcr.io/${{ github.repository }}:v${{ env.VERSION }}${{ matrix.variant.tagSuffix }}
push: true
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_REPOSITORY: lucasgaitzsch/pdf-turtle
short-description: ${{ github.event.repository.description }}