Skip to content

Commit d0a48c5

Browse files
committed
add github action
1 parent 1be0247 commit d0a48c5

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Test and Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build-test-and-lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Cache Docker layers
21+
uses: actions/cache@v3
22+
with:
23+
path: /tmp/.buildx-cache
24+
key: ${{ runner.os }}-buildx-${{ github.sha }}
25+
restore-keys: |
26+
${{ runner.os }}-buildx-
27+
28+
- name: Build Docker image
29+
run: |
30+
make docker/build
31+
32+
- name: Run Docker container for tests
33+
run: |
34+
docker run --rm \
35+
-e DJANGO_SETTINGS_MODULE=intbot.settings \
36+
-e DATABASE_URL=postgres://testuser:testpassword@localhost:5432/testdb \
37+
--network host \
38+
intbot \
39+
make test
40+
41+
services:
42+
postgres:
43+
image: postgres:16.4
44+
env:
45+
POSTGRES_USER: testuser
46+
POSTGRES_PASSWORD: testpassword
47+
POSTGRES_DB: testdb
48+
ports:
49+
- 5432:5432
50+
options: >-
51+
--health-cmd="pg_isready -U testuser -d testdb"
52+
--health-interval=10s
53+
--health-timeout=5s
54+
--health-retries=5
55+

0 commit comments

Comments
 (0)