ci(codecov): integrated codecov
#16
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: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test-in-containerized: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codebase | |
uses: actions/checkout@v3 | |
- name: Create .env file | |
uses: SpicyPizza/create-envfile@v1.3 | |
with: | |
envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
envkey_ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }} | |
envkey_DB_ENGINE: ${{ secrets.DB_ENGINE }} | |
envkey_CHANNEL_LAYER_BACKEND: ${{ secrets.CHANNEL_LAYER_BACKEND }} | |
envkey_REDIS_SERVER: ${{ secrets.REDIS_SERVER }} | |
envkey_REDIS_PORT: ${{ secrets.REDIS_PORT }} | |
- name: Build image with docker compose | |
run: docker compose build --no-cache | |
- name: Run test | |
run: docker compose run --rm backend pytest | |
build-and-test-on-host: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codebase | |
uses: actions/checkout@v3 | |
- name: Create .env file | |
uses: SpicyPizza/create-envfile@v1.3 | |
with: | |
envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
envkey_ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }} | |
envkey_DB_ENGINE: ${{ secrets.DB_ENGINE }} | |
envkey_CHANNEL_LAYER_BACKEND: ${{ secrets.CHANNEL_LAYER_BACKEND }} | |
envkey_REDIS_SERVER: ${{ secrets.REDIS_SERVER }} | |
envkey_REDIS_PORT: ${{ secrets.REDIS_PORT }} | |
- name: Install project dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run test | |
run: | | |
pytest | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 |