[PATCH v3 3/6] ci: test supported docker container operations
You-Sheng Yang
vicamo at gmail.com
Thu Dec 9 04:02:35 AEDT 2021
Signed-off-by: You-Sheng Yang <vicamo at gmail.com>
---
.github/workflows/ci.yaml | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index d37cdbf..6e9033d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -116,6 +116,8 @@ jobs:
strategy:
matrix:
db: [postgres, mysql]
+ env:
+ COMPOSE_FILE: ${{ matrix.db == 'mysql' && 'docker-compose.yml' || 'docker-compose-pg.yml' }}
steps:
- name: Checkout source code
uses: actions/checkout at v2
@@ -125,11 +127,30 @@ jobs:
uses: actions/setup-python at v2
with:
python-version: 3.9
- - name: Bring up docker-compose service
- env:
- COMPOSE_FILE: ${{ matrix.db == 'mysql' && 'docker-compose.yml' || 'docker-compose-pg.yml' }}
+ - name: Build docker-compose service
run: |
docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g)
+ - name: Test createsuperuser/changepassword
+ run: |
+ docker-compose run -T --rm web \
+ python manage.py createsuperuser \
+ --username patchwork --no-input --email test at example.com
+ { echo patchwork; echo patchwork; } | \
+ docker-compose run -T --rm web \
+ python manage.py changepassword patchwork
+ - name: Test dbbackup/dbrestore
+ run: |
+ docker-compose run -T --rm web python manage.py dbbackup
+ echo y | docker-compose run -T --rm web python manage.py dbrestore
+ - name: Modify database user permissions (mysql)
+ if: ${{ matrix.db == 'mysql' }}
+ run: |
+ docker-compose exec -T -- db \
+ sh -c "exec mysql -uroot -p\"\${MYSQL_ROOT_PASSWORD}\" -e \"GRANT ALL ON \\\`test\\_\${MYSQL_DATABASE}%\\\`.* to '\${MYSQL_USER}'@'%'; FLUSH PRIVILEGES;\""
+ - name: Run unittest
+ run: docker-compose run -T --rm web tox
+ - name: Test normal startup
+ run: |
docker-compose up --detach
for count in $(seq 50); do \
@@ -140,12 +161,6 @@ jobs:
done
echo
- docker-compose exec -T web \
- python manage.py createsuperuser \
- --username patchwork --no-input --email test at example.com
- { echo patchwork; echo patchwork; } | \
- docker-compose exec -T web \
- python manage.py changepassword patchwork
docker-compose ps
- name: Test client access (git-pw)
run: |
--
2.32.0
More information about the Patchwork
mailing list