Merge pull request #788 from CDLUC3/develop #1218
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: EZID CI | |
on: push | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
env: | |
IS_CI: 1 | |
DJANGO_SETTINGS_MODULE: settings.tests | |
PYTHONPATH: ${{ github.workspace }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Start MySQL service | |
run: | | |
sudo /etc/init.d/mysql start | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: pip install . | |
- name: Install dev dependencies | |
run: pip install -r requirements-dev.txt | |
- name: Validate installed packages against poetry.lock file | |
run: poetry check --lock | |
- name: Dump environment (for troubleshooting) | |
run: | | |
printf 'PYTHONPATH: %s\n' "$PYTHONPATH" | |
# apt-cache pkgnames | sort | |
# find / | grep /bin/ | sort | |
# pip freeze | |
# pip check || true | |
# python --version | |
echo "CWD=${PWD}" | |
ls -l | |
# mysql -e ' | |
# use ezid_test_db; | |
# show tables; | |
# select prefix, minter from ezidapp_shoulder; | |
# ' | |
- name: Prepare DB | |
run: | | |
mysql -h127.0.0.1 -uroot -proot << EOF | |
drop database if exists ezid_test_db; | |
create database ezid_test_db; | |
use ezid_test_db; | |
drop user if exists 'ezid_test_user'@'%'; | |
create user 'ezid_test_user'@'%' identified by 'ezid_test_pw'; | |
grant all privileges on ezid_test_db.* to 'ezid_test_user'@'%'; | |
flush privileges; | |
EOF | |
- name: Prepare filesystem | |
run: | | |
mkdir -p ../download/public ../logs | |
- name: Setup DB and static files | |
run: | | |
# ./manage.py makemigrations --merge --no-input | |
# ./manage.py makemigrations ezidapp | |
./manage.py migrate | |
./manage.py collectstatic --no-input | |
- name: Load DB fixture | |
run: | | |
# ./manage.py loaddata --ignorenonexistent db | |
./manage.py loaddata db | |
#./manage.py diag-update-admin | |
- name: Run tests | |
env: | |
PYTHONPATH: ${{ github.workspace }} | |
run: | | |
pytest --maxfail 10 | |
# - pip install -e . |