Skip to content

ci: add ci

ci: add ci #3

Workflow file for this run

name: xzdp CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
fmt:
name: Run go fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Run go fmt
run: |
fmt_output=$(go fmt ./...)
if [ -n "$fmt_output" ]; then
echo "The following files need to be formatted:"
echo "$fmt_output"
exit 1
fi
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Install dependencies
run: go mod tidy
- name: Build
run: ./script/build.sh
test:
name: Run tests
runs-on: ubuntu-latest
needs: build
services:
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Install dependencies
run: go mod tidy
- name: Run tests
env:
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
run: ./script/test.sh