Merge pull request #239 from thingspect/bconway_github_ci_style_fixes #557
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
services: | |
postgres: | |
image: postgres:16-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 }} | |
nsqd: | |
image: ghcr.io/thingspect/nsqd:v1.2.1 | |
credentials: | |
username: thingspect | |
password: ${{ secrets.GHCR_PAT }} | |
env: | |
LOOKUP_ADDR: nsqlookupd:4160 | |
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 | |
# Add packages needed to support checkout, builds, and tests | |
run: | | |
apk update && apk upgrade | |
apk add --no-cache make git | |
go version | |
go env | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Restart_MQTT | |
# Restart MQTT after volumes have been checked out | |
uses: docker://docker | |
with: | |
args: docker restart mqtt | |
- name: Build_and_Test | |
run: make test | |
- name: Push | |
# Run Dockerfile build and condense four actions into one step | |
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 |