Removed Dockerfile #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python and JS tests run against API demo | |
permissions: | |
contents: read | |
pull-requests: read | |
on: | |
push: | |
branches: [ '**' ] | |
pull_request: | |
branches: [ '**' ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the AIMS UI repository | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Install Docker Compose for deploying the API | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- name: Start the API via Docker Compose | |
run: | | |
docker-compose -f api_demo/docker-compose.yml up -d | |
docker ps -a # for debugging - shows running containers | |
# Wait for API to be ready (checking port 9001) (will return 'hello world' when ready) | |
- name: Wait for API to be ready | |
run: | | |
timeout 340s bash -c 'until curl -s http://localhost:9001; do sleep 5; done' | |
# Download and inflate Design System Components | |
- name: Download and inflate Design System Components | |
run: | | |
scripts/load_templates.sh | |
# Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements_test.txt | |
- name: Install the UI as a python package | |
run: | | |
pip install -e . | |
- name: Install Playwright Browsers | |
run: | | |
python3 -m playwright install --with-deps | |
# Run flask server in "testing" environment | |
- name: Run Flask Server | |
env: | |
FLASK_ENV: testing | |
run: | | |
python3 wsgi.py & | |
# Run Python tests | |
- name: Run Python tests | |
run: | | |
python3 -m pytest tests/pytest_tests -n 4 | |
# Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' # Replace with the Node.js version you need | |
- name: Install npm dependencies | |
run: npm install | |
- name: Run JavaScript tests | |
run: npm run test:jest | |
# Stop Docker Compose and clean up | |
- name: Stop and clean up Docker containers | |
if: always() | |
run: | | |
cd api_demo | |
docker-compose down | |