Skip to content

test model renames

test model renames #86

Workflow file for this run

name: ci-checks
on: [pull_request]
jobs:
backend:
name: backend
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: bmds
POSTGRES_PASSWORD: password
POSTGRES_DB: bmds-online-test
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 5432/tcp
steps:
- name: Checkout bmds-server
uses: actions/checkout@v3
- name: Checkout bmds@main
uses: actions/checkout@v3
with:
repository: USEPA/bmds-private
path: venv
ref: main
token: ${{ secrets.USEPA_BMDS_PRIVATE_PAT }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: try to restore pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: loc
run: |
sudo apt-get install -y cloc
make loc
- name: install
run: |
mv tests/data/ci-webpack-stats.json bmds_server/webpack-stats.json
pip install -U pip wheel
pip install -r requirements/ci.txt
- name: Setup linux environment
run: |
sudo apt-get update -y
sudo apt-get install -y make libgslcblas0 libgsl-dev
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib"
sudo cp vendor/libnlopt.so /usr/local/lib/libnlopt.so.0
sudo ln -s /lib/x86_64-linux-gnu/libgsl.so /usr/local/lib/libgsl.so.25
export "BMD_DLL=$GITHUB_WORKSPACE/venv/bmds/bmdscore.cpython-*-x86_64-linux-gnu.so"
ldd $BMD_DLL
- name: lint
run: |
make lint-py
- name: test
env:
DJANGO_DB_NAME: bmds-online-test
DJANGO_DB_USER: bmds
DJANGO_DB_PW: password
DJANGO_DB_HOST: localhost
DJANGO_DB_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
run: |
export "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH"
coverage run -m pytest --vcr-record=none
echo "# Python coverage report" >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
frontend:
name: frontend
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: try to restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('frontend/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: install
run: |
yarn --cwd ./frontend install
- name: lint
run: |
make lint-js
- name: test
run: |
npm --prefix ./frontend run test
- name: build for integration tests
run: |
npm --prefix ./frontend run build
- name: Upload webpack build
uses: actions/upload-artifact@v3
with:
name: webpack-build
path: |
bmds_server/webpack-stats.json
bmds_server/static/bundles/
integration:
name: integration
needs: [backend, frontend]
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: bmds
POSTGRES_PASSWORD: password
POSTGRES_DB: bmds-online-test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
DJANGO_DB_HOST: localhost
DJANGO_DB_NAME: bmds-online-test
DJANGO_DB_PW: password
DJANGO_DB_USER: bmds
INTEGRATION_TESTS: 1
LIVESERVER_HOST: localhost
LIVESERVER_PORT: 8000
steps:
- uses: actions/checkout@v3
- name: Checkout bmds@main
uses: actions/checkout@v3
with:
repository: USEPA/bmds-private
path: venv
ref: main
token: ${{ secrets.USEPA_BMDS_PRIVATE_PAT }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: try to restore pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download webpack build
uses: actions/download-artifact@v3
with:
name: webpack-build
path: bmds_server
- name: install
run: |
pip install -U pip
pip install -r requirements/ci.txt
playwright install --with-deps chromium
- name: Setup linux environment
run: |
sudo apt-get update -y
sudo apt-get install -y make libgslcblas0 libgsl-dev
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib"
sudo cp vendor/libnlopt.so /usr/local/lib/libnlopt.so.0
sudo ln -s /lib/x86_64-linux-gnu/libgsl.so /usr/local/lib/libgsl.so.25
export "BMD_DLL=$GITHUB_WORKSPACE/venv/bmds/bmdscore.cpython-*-x86_64-linux-gnu.so"
ldd $BMD_DLL
# https://github.community/t/how-to-retry-a-failed-step-in-github-actions-workflow/125880
- name: run integration tests
id: test
continue-on-error: true
run: |
export "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH"
py.test -sv tests/integration/
- name: run integration tests (retry)
if: steps.test.outcome=='failure'
id: retry
continue-on-error: true
run: |
export "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH"
py.test -sv tests/integration/
- name: set status
if: always()
run: |
if ${{ steps.test.outcome=='success' || steps.retry.outcome=='success' }}; then
echo success!
else
exit 1
fi