Implement watch mode for development #2214
Workflow file for this run
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: Tests | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| container: | |
| image: ghcr.io/weasyl/ci-base-image@sha256:4df75acfb590a0617eb80e9a4283b307193e30ff8e3ac8b9cb2eab430248b17f | |
| options: --user 1001 | |
| services: | |
| weasyl-database: | |
| image: postgres:9.6 | |
| env: | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| POSTGRES_USER: weasyl | |
| POSTGRES_DB: weasyl_test | |
| # probably ready by the time the tests run anyway; no need to add latency | |
| #options: >- | |
| # --health-cmd pg_isready | |
| # --health-interval 10s | |
| # --health-timeout 5s | |
| # --health-retries 5 | |
| weasyl-memcached: | |
| image: memcached:1.5-alpine | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Deno dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/deno | |
| key: cache-${{ runner.os }}-deno-${{ hashFiles('deno.lock') }} | |
| restore-keys: | | |
| cache-${{ runner.os }}-deno- | |
| - name: Cache Poetry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: cache-${{ runner.os }}-pip-${{ hashFiles('poetry-requirements.txt') }} | |
| restore-keys: | | |
| cache-${{ runner.os }}-pip- | |
| - name: Cache Python dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: cache-${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
| restore-keys: | | |
| cache-${{ runner.os }}-poetry- | |
| - name: Create Poetry virtualenv | |
| run: python3 -m venv --system-site-packages --without-pip .poetry-venv | |
| - name: Install Poetry | |
| run: | | |
| .poetry-venv/bin/python3 -m pip install --require-hashes --only-binary :all: --no-deps -r poetry-requirements.txt | |
| - name: Create virtualenv | |
| run: python3 -m venv --system-site-packages --without-pip .venv | |
| - name: Install Deno dependencies | |
| run: deno install --frozen --vendor=false && deno install --frozen | |
| - name: Install Python dependencies | |
| run: .poetry-venv/bin/poetry install | |
| - name: Configure Weasyl | |
| run: | | |
| cp ci/site.config.txt config/ | |
| cp config/weasyl-staff.example.py config/weasyl-staff.py | |
| cat imagemagick-policy.xml > /usr/etc/ImageMagick-6/policy.xml | |
| printf %.8s "$GITHUB_SHA" > version.txt | |
| - name: Build assets | |
| run: | | |
| deno run \ | |
| --cached-only \ | |
| --frozen \ | |
| --allow-env \ | |
| --allow-read \ | |
| --allow-write \ | |
| --allow-run \ | |
| build.ts \ | |
| --assets=./assets/ \ | |
| --output=./build/ | |
| - name: Test libweasyl | |
| env: | |
| WEASYL_TEST_SQLALCHEMY_URL: postgresql+psycopg2://weasyl@weasyl-database/weasyl_test | |
| run: .venv/bin/coverage run -m pytest libweasyl.test libweasyl.models.test | |
| - name: Test weasyl | |
| env: | |
| WEASYL_APP_ROOT: . | |
| WEASYL_STORAGE_ROOT: testing | |
| run: .venv/bin/coverage run -m pytest weasyl.test | |
| - name: Create coverage report | |
| run: | | |
| .venv/bin/coverage combine | |
| .venv/bin/coverage xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} |