Add Data Extraction #238
Workflow file for this run
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: Backend CI | |
# Enable Buildkit and let compose use it to speed up image building | |
env: | |
DOCKER_BUILDKIT: 1 | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True | |
defaults: | |
run: | |
working-directory: ./ | |
on: | |
pull_request: | |
branches: [ "master", "main" ] | |
paths-ignore: [ "docs/**" ] | |
push: | |
branches: [ "master", "main" ] | |
paths-ignore: [ "docs/**" ] | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
cache-dependency-path: | | |
requirements/base.txt | |
requirements/local.txt | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
# With no caching at all the entire ci process takes 4m 30s to complete! | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/[email protected] | |
- name: Store Codecov Env Flags | |
run: | | |
# use bash variable expression to get the substring | |
ci_env=`bash <(curl -s https://codecov.io/env)` | |
echo "$ci_env" | |
- name: Build the Stack | |
run: docker-compose -f test.yml build | |
- name: Run DB Migrations | |
run: docker-compose -f test.yml run --rm django python manage.py migrate | |
- name: Collect Static Files | |
run: docker-compose -f test.yml run --rm django python manage.py collectstatic | |
- name: Build Pytest Coverage File | |
run: | | |
docker-compose -f test.yml run django coverage run -m pytest --cov-report=xml --cov | |
- name: Upload Coverage Reports to Codecov | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || env.GITHUB_SHA }} | |
run: | | |
# use bash variable expression to get the substring | |
ci_env=`bash <(curl -s https://codecov.io/env)` | |
docker-compose -f test.yml run $ci_env django /bin/codecov -v -t ${CODECOV_TOKEN} -R . -f coverage.xml -C ${COMMIT_SHA} | |
- name: Tear down the Stack | |
run: docker-compose -f test.yml down |