Fix pr #198: Fix issue #197: Add timestamps to models demo #389
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
| # The visible name that will appear in the github interface. | |
| name: Django Tests | |
| # You can specify branches and other actions, but the on: push directive is one of the most basics. Everytime there's a push on any branch, this workflow will be triggered and will execute its jobs. | |
| on: push | |
| # You can define environment variables on a global level for the workflow. | |
| # Here we define variables for the postgres database. | |
| # More information on how environment variables work here: https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow | |
| env: | |
| POSTGRES_DB: postgres | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_HOST: 127.0.0.1 | |
| POSTGRES_PORT: 5432 | |
| SECRET_KEY: dummy | |
| jobs: | |
| django_tests: | |
| # This job will run on a Ubuntu Linux runner with the Ubuntu version 22.04. | |
| # Because this job requires a postgres database and it uses a docker container for that purpose. The Runner must be a Linux-based OS. | |
| runs-on: ubuntu-20.04 | |
| # Services are Docker containers. For this job, we are using a postgres container for the database. | |
| # See more information regarding the services here: https://docs.github.com/en/actions/using-containerized-services/about-service-containers | |
| services: | |
| postgres: | |
| image: "postgres:14" | |
| env: | |
| POSTGRES_PASSWORD: ${{env.POSTGRES_PASSWORD}} | |
| POSTGRES_USER: ${{env.POSTGRES_USER}} | |
| POSTGRES_DB: ${{env.POSTGRES_DB}} | |
| POSTGRES_HOST: ${{env.POSTGRES_HOST}} | |
| POSTGRES_PORT: ${{env.POSTGRES_PORT}} | |
| # Note that we didn't use ${{env.POSTGRES_PORT}} in the ports section. That's because you don't have access to the env object in the ports section. | |
| # Read more about this here: https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | |
| ports: | |
| - 5432:5432 | |
| # These are just some optional yet recommended health checks. | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| revent-s3: | |
| image: localstack/localstack:latest | |
| ports: | |
| - "4566:4566" | |
| - "4510-4559:4510-4559" | |
| steps: | |
| # This is the first step. The "uses" keyword specifies that this step will run v3 of the actions/checkout action. This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). | |
| # You can read more about this action here: https://github.com/actions/checkout#readme | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.10.13 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10.13" | |
| - name: Install and configure Poetry | |
| run: | | |
| INSTALL_PATH="$HOME/.local" | |
| INSTALLATION_SCRIPT="$(mktemp)" | |
| VIRTUALENVS_PATH="{cache-dir}/virtualenvs/#\~/$HOME" | |
| curl -sSL https://install.python-poetry.org/ --output "$INSTALLATION_SCRIPT" | |
| POETRY_HOME=$INSTALL_PATH python3 "$INSTALLATION_SCRIPT" --yes --version="1.3.2" | |
| export PATH="/root/.local/bin:$PATH" | |
| poetry config virtualenvs.create true | |
| poetry config virtualenvs.in-project true | |
| poetry config virtualenvs.path "$VIRTUALENVS_PATH" | |
| echo "VENV=.venv/bin/activate" >> "$GITHUB_ENV" | |
| - name: Install Dependencies | |
| run: | | |
| export PATH="/root/.local/bin:$PATH" | |
| poetry install --no-interaction | |
| - name: Run Tests | |
| env: | |
| DJANGO_SETTINGS_MODULE: config.settings | |
| AWS_S3_ENDPOINT_URL: http://localhost.localstack.cloud:4566/ | |
| AWS_DEFAULT_REGION: us-west-1 | |
| AWS_S3_BUCKET_NAME: revent-storage | |
| AWS_STORAGE_BUCKET_NAME: revent-media | |
| AWS_ACCESS_KEY_ID: test | |
| AWS_SECRET_ACCESS_KEY: test | |
| AWS_QUERYSTRING_AUTH: False | |
| AWS_S3_SIGNATURE_VERSION: s3v4 | |
| ALLOWED_HOSTS: localhost,127.0.0.1,0.0.0.0 | |
| GOOGLE_CLIENT_ID: test | |
| GOOGLE_CLIENT_SECRET: test | |
| CSRF_TRUSTED_ORIGINS: http://localhost,http://localhost:3000,http://127.0.0.1:3000,http://127.0.0.1 | |
| CORS_ALLOWED_ORIGINS: http://localhost,http://localhost:3000,http://127.0.0.1:3000,http://127.0.0.1,http://127.0.0.1:3001 | |
| CORS_ORIGIN_WHITELIST: 127.0.0.1 | |
| ALLOWED_REDIRECT_URIS: http://localhost:3000,http://localhost/,http://127.0.0.1:3000 | |
| BASE_BACKEND_URL: http://localhost:8000/ | |
| BASE_APP_URL: http://localhost:3000/ | |
| run: | | |
| source $VENV | |
| python manage.py test |