forked from mailgun/kafka-pixy
-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (48 loc) · 1.34 KB
/
test_on_push.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
name: Run tests
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
env:
KAFKA_PEERS: 127.0.0.1:9092
ZOOKEEPER_PEERS: 127.0.0.1:2181
KAFKA_HOSTNAME: 127.0.0.1
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PKG_WRITER_PAT }}
- name: Cache deps
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install deps
run: go mod download
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 zookeeper" | sudo tee -a /etc/hosts
- name: Start containers
run: docker-compose up -d
- name: Create test topics
run: .github/create_topics.sh
- name: Run tests
run: make test
- name: Stop containers
if: always()
run: docker-compose down