Skip to content

sort project admin by name - add flake8 exlusions #705

sort project admin by name - add flake8 exlusions

sort project admin by name - add flake8 exlusions #705

Workflow file for this run

name: CI, approaching CD
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
jobs:
run_jobs:
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Build database
run: psql -c "CREATE DATABASE githubactions;" -U postgres -h localhost -p 5432
env:
PGPASSWORD: postgres
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage coveralls pyarrow pandas # for one_cache tests
env:
PIP_USE_MIRRORS: true
- name: Run tests
run: |
sudo touch /var/log/alyx.log; sudo chmod 666 /var/log/alyx.log
sudo touch /var/log/alyx_json.log; sudo chmod 666 /var/log/alyx_json.log
cd alyx
cp alyx/settings_ci.py alyx/settings.py
python manage.py collectstatic --noinput --link
coverage run manage.py test -n
coveralls --service=github
env:
DJANGO_SETTINGS_MODULE: alyx.settings
PYTHONPATH: $HOME/builds/cortexlab/alyx
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Flake
run: |
cd alyx
flake8 .
- name: Generate new requirements_frozen.txt if needed
# Only runs when branch pushed to directly OR when a PR is merged
if: ${{ github.event_name == 'push' }}
run: |
pip freeze > requirements_frozen_temp.txt
if diff requirements_frozen.txt requirements_frozen_temp.txt > /dev/null; then
echo "requirements_frozen.txt unchanged"
rm requirements_frozen_temp.txt
echo "GIT_PUSH_NEEDED=false" >> "$GITHUB_ENV"
else
echo "requirements_frozen.txt is different, git push needed"
mv requirements_frozen_temp.txt requirements_frozen.txt
echo "GIT_PUSH_NEEDED=true" >> "$GITHUB_ENV"
fi
- name: Setup git/commit/push for requirements_frozen.txt if needed
# Only runs when requirements_frozen.txt is updated
if: env.GIT_PUSH_NEEDED == 'true'
run: |
git config user.name github-actions
git config user.email [email protected]
git add requirements_frozen.txt
git commit -m "GitHub Actions generated requirements_frozen.txt"
git push
# Docker steps only run when master branch pushed to directly OR when a PR is merged
- name: Set Docker conditional value if needed
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
echo "DOCKER_PUSH_NEEDED=true" >> "$GITHUB_ENV"
- name: Configure Docker login if needed
if: env.DOCKER_PUSH_NEEDED == 'true'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx if needed
if: env.DOCKER_PUSH_NEEDED == 'true'
uses: docker/setup-buildx-action@v1
- name: Build and push Docker base image if needed
if: env.DOCKER_PUSH_NEEDED == 'true'
uses: docker/build-push-action@v2
with:
context: .
file: ./scripts/deployment_examples/alyx-docker/Dockerfile.base
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/alyx:base