Skip to content

Commit 8f377b2

Browse files
authored
Merge pull request #15 from neutrons/ci_unittest
Add GitHub actions for unit tests
2 parents 05627f9 + 1fa4fd2 commit 8f377b2

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

.github/workflows/unittest.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: unit-test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: main
8+
tags: ['v*']
9+
10+
jobs:
11+
linux:
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
shell: bash -l {0}
16+
env:
17+
DATABASE_NAME: livedatadb
18+
DATABASE_USER: livedatauser
19+
DATABASE_PASS: livedatapass
20+
DATABASE_HOST: db
21+
DATABASE_PORT: 5432
22+
LIVE_PLOT_SECRET_KEY: "1234_live_data_server"
23+
DJANGO_SUPERUSER_USERNAME: livedatauser
24+
DJANGO_SUPERUSER_PASSWORD: livedatapass
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: conda-incubator/setup-miniconda@v2
28+
with:
29+
auto-update-conda: true
30+
channels: conda-forge,defaults
31+
mamba-version: "*"
32+
environment-file: environment.yml
33+
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
34+
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
35+
- name: Start docker containers
36+
run: |
37+
cp ./config/docker-compose.envlocal.yml docker-compose.yml
38+
docker compose up --build -d
39+
- name: Sleep, wait for containers to start up
40+
run: sleep 30
41+
- name: Run unit tests
42+
run: python -m pytest tests/

config/docker-compose.envlocal.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42

53
nginx:

0 commit comments

Comments
 (0)