forked from mautrix/imessage
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (90 loc) · 2.62 KB
/
go.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Go
on:
push:
branches:
- master
- feat-*
- ci
tags:
- v*
env:
GO_VERSION: "1.22"
GHCR_REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
export PATH="$HOME/go/bin:$PATH"
- name: Install pre-commit
run: pip install pre-commit
- name: Lint
run: pre-commit run -a
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version: ${{ env.GO_VERSION }}
# cache: true
# - name: Install libolm and other dependencies
# run: sudo apt-get install libolm-dev libolm3 gobjc++-mingw-w64 gcc g++ build-essential
# - name: Set up gotestfmt
# uses: GoTestTools/gotestfmt-action@v2
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# - name: Run tests
# run: |
# go test -v -json ./... -cover | gotestfmt
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install libolm
run: sudo apt-get install libolm-dev libolm3 gobjc++-mingw-w64
- name: Build
run: bash ./build.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.GHCR_REGISTRY_IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,format=long
type=raw,latest
- name: Docker Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.ci
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.GHCR_REGISTRY_IMAGE }}:latest
cache-to: type=inline