Multidimensional algorithm inputs and output support #5
This file contains hidden or 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: Pull Request Checks | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
black-format-check: # Check that the codebase is formatted with black | |
name: Black format check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies and check black format | |
run: | | |
python -m pip install --upgrade pip | |
pip install black | |
black --check --diff . | |
flake8-check: # Check that the codebase does not contain linting errors | |
name: Flake8 check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies and check flake8 format | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
flake8 . | |
cspell-check: # Check that the project does not contain spelling errors | |
name: CSpell check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install dependencies and check prettier format | |
run: npm install -g cspell && cspell --no-summary --no-progress --no-color . | |
python-tests: # Install dependencies and run tests with pytest | |
name: Python tests | |
needs: [black-format-check, flake8-check, cspell-check] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
pip install -r requirements.txt | |
- name: Test with pytest | |
run: | | |
python websrv.py & sleep 5 && pytest tests/ | |
docker-build-check: # Build the docker image and check that it can run | |
name: Docker build check | |
needs: [black-format-check, flake8-check, cspell-check] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build the Docker image | |
run: docker build -t algo-provider . | |
- name: Run the Docker image | |
run: docker run -d -p 3000:3000 algo-provider | |
- name: Wait for the Docker container to start | |
run: | | |
echo "Waiting for container status..." | |
for i in {1..10}; do | |
sleep 3 | |
container_id=$(docker ps -q -f "ancestor=algo-provider") | |
status=$(docker inspect --format='{{.State.Status}}' $container_id | tr -d '[:space:]') | |
echo "Docker status: '$status'"; | |
if [ "$status" = "running" ]; then | |
echo "Container is running" | |
exit 0 | |
elif [ "$status" = "exited" ]; then | |
echo "Container exited" | |
exit 1 | |
fi | |
done | |
echo "Container was supposed to be running but it is not" | |
exit 1 |