Check if sleep is necessary #14
This file contains hidden or 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: Test container startup | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| main: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Docker Compose | |
| uses: docker/setup-compose-action@v1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: Install poetry | |
| uses: abatilo/actions-poetry@v2 | |
| - name: Install dependencies | |
| run: | | |
| poetry install --with test | |
| - name: Get dvc hash for export directory | |
| run: | | |
| echo "EXPORT_DVC_HASH=$(poetry run python scripts/get_dvc_md5.py export.dvc)" >> $GITHUB_ENV | |
| - name: Cache dvc directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: .dvc | |
| key: ${{ runner.os }}-${{ env.EXPORT_DVC_HASH }} | |
| - name: Pull database tables | |
| run: | | |
| poetry run dvc pull -v | |
| - name: Set variables | |
| run: | | |
| echo "POSTGRES_PASSWORD=$(uuidgen)" >> $GITHUB_ENV | |
| echo "DTOCEAN_USER_PASSWORD=$(uuidgen)" >> $GITHUB_ENV | |
| echo "PGADMIN_DEFAULT_PASSWORD=$(uuidgen)" >> $GITHUB_ENV | |
| echo "DTOCEAN_DB_VERSION=mock" >> $GITHUB_ENV | |
| - name: Test container startup | |
| shell: bash | |
| run: | | |
| set +e | |
| timeout --preserve-status 150s docker compose -f docker-compose.yml up --abort-on-container-failure | |
| if [[ $? -ne 130 ]]; then | |
| exit 1 | |
| fi | |
| - name: Test database initialization | |
| run: | | |
| docker compose -f docker-compose.yml start | |
| docker compose ps | |
| poetry run pytest tests | |
| docker compose -f docker-compose.yml stop |