-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (87 loc) · 2.7 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
81
82
83
84
85
86
87
88
89
name: Atlas CI
on: push
jobs:
build:
name: Build
runs-on: ubuntu-latest
container:
image: golang:1.21-alpine
env:
GOFLAGS: -buildvcs=false
TEST_REDIS_HOST: redis
TEST_PG_URI: pgx://postgres:postgres@postgres/atlas_test
TEST_NSQ_PUB_ADDR: nsqd:4150
TEST_NSQ_LOOKUP_ADDRS: nsqlookupd:4161
TEST_MQTT_ADDR: tcp://mqtt:1883
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: atlas_test
nsqlookupd:
image: ghcr.io/thingspect/nsqlookupd:v1.2.1
credentials:
username: thingspect
password: ${{ secrets.GHCR_PAT }}
env:
LOG_LEVEL: warn
nsqd:
image: ghcr.io/thingspect/nsqd:v1.2.1
credentials:
username: thingspect
password: ${{ secrets.GHCR_PAT }}
env:
LOOKUP_ADDR: nsqlookupd:4160
LOG_LEVEL: warn
mqtt:
image: eclipse-mosquitto:2.0
volumes:
- ${{ github.workspace }}/build/volume/mosquitto:/mosquitto/config
options: --name mqtt
redis:
image: redis:7-alpine
steps:
- name: Deps
# Names are duplicated as IDs for use by Notify
id: Deps
# Add packages needed to support builds and tests
run: |
apk update && apk upgrade
apk add --no-cache make git
go version
go env
- name: Clone
id: Clone
uses: actions/checkout@v3
- name: Restart_MQTT
id: Restart_MQTT
# Restart MQTT after volumes have been checked out
uses: docker://docker
with:
args: docker restart mqtt
- name: Build_and_Test
id: Build_and_Test
run: make test
- name: Push
id: Push
# GitHub Actions does not currently support Docker within a container
run: |
apk add --no-cache docker docker-cli-buildx
docker version
docker login -u thingspect -p ${{ secrets.GHCR_PAT }} ghcr.io
git config --global --add safe.directory /__w/atlas/atlas
TAG=$(git rev-parse --short=8 HEAD)
docker buildx create --use
#docker buildx build -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --platform linux/amd64,linux/arm64 --push .
docker buildx build -f build/Dockerfile -t ghcr.io/thingspect/atlas:${TAG} --push .
docker buildx rm
docker logout ghcr.io
- name: Notify
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: always()