-
Notifications
You must be signed in to change notification settings - Fork 72
95 lines (81 loc) · 2.76 KB
/
build_test_containers.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build, test and publish containers
on:
pull_request:
branches:
- '*'
push:
branches:
- '*'
tags:
- '*'
jobs:
simulation-tests:
name: Build containers and run boptest simulation tests
runs-on: ubuntu-22.04
timeout-minutes: 240
env:
COMPOSE_PROJECT_NAME: boptest_service
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Build and run stack
run: |
cd service
docker compose build
docker compose up -d web worker
- name: dump docker logs
uses: jwalton/gh-docker-logs@v1
- name: Upload test cases to minio
run: |
# The provision script will wait for the web service to be available,
# so there is no need for an external wait-for-it script
cd service
docker compose run --no-deps provision
curl http://localhost/testcases
- name: Run example
run: |
python --version
pip install requests matplotlib numpy pandas
PYTHONPATH=$GITHUB_WORKSPACE
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
# Storing PYTHONPATH above doesn't work for python so setting it below at run
PYTHONPATH=$PWD python examples/python/testcase1.py
- name: Run tests
run: |
cd service
docker compose run --no-deps test
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
#------------------------- Push to GitHub registry (disabled) -----------------------------
- name: Log in to the GitHub container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_REGISTRY }}
- name: Publish docker images to GitHub Registry
if: |
github.ref == 'refs/heads/develop' ||
contains(github.ref, 'refs/tags')
shell: bash
run: service/ci/publish_to_github.sh
#------------------ Push to docker hub (disabled) -------------------------------------
#
# - name: Log in to Docker Hub
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# username: ${{ secrets.DOCKER_USER }}
# password: ${{ secrets.DOCKER_PASS }}
#
# - name: Publish docker images to Docker Hub
# if: |
# github.ref == 'refs/heads/develop' ||
# github.ref == 'refs/heads/experimental' ||
# contains(github.ref, 'refs/tags')
# shell: bash
# run: service/ci/publish_to_docker.sh