-
Notifications
You must be signed in to change notification settings - Fork 5
80 lines (69 loc) · 1.84 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ci:
name: Integration
strategy:
matrix:
os:
- ubuntu-latest
go_version:
- '1.20'
- '1.21'
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
- name: Set up tools
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
- uses: actions/checkout@v4
- name: Build
run: make build
- name: Test
run: make test-race
- name: Coverage
run: |
make coverage
mv coverage-dev.txt coverage.txt
bash <(curl -s https://codecov.io/bash)
- name: Lint
run: make lint
- name: Code Analysis
run: make ca
- name: Notify Telegram
uses: yanzay/notify-telegram@v0.1.0
continue-on-error: true
if : always()
with:
chat: ${{ secrets.chat }}
token: ${{ secrets.token }}
status: ${{ job.status }}
build-image:
name: Build Image for Deployment
needs: ci
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: ghcr.io/euler-b/golang-venezuela/adan-bot
steps:
- name: Get source code
uses: actions/checkout@v4
- name: "Login into Github Container Registry (a.k.a. ghcr.io)"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ SECRETS.GITHUB_TOKEN }}
- name: "Build and push Docker image to Github Container Registry ('latest')"
if: ${{ github.ref == 'refs/heads/main' }}
run: |
docker build --tag $DOCKER_IMAGE:latest .
docker push $DOCKER_IMAGE:latest