name: Django CI on: push: branches: [master] pull_request: branches: [master] jobs: dependencies: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: bahmutov/npm-install@v1 - run: node node_modules/gulp/bin/gulp build - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Cache python deps uses: actions/cache@v2 with: path: ${{ env.pythonLocation }} key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} - name: Setup Chromedriver if: \!${{ matrix.parallel }} run: | wget https://chromedriver.storage.googleapis.com/2.36/chromedriver_linux64.zip unzip chromedriver_linux64.zip export PATH=$PATH:$(pwd) chmod +x chromedriver export PATH=$PATH:/usr/lib/chromium-browser/ - name: Install Dependencies run: | python -m pip install --upgrade pip pip install pycodestyle pip install --upgrade --upgrade-strategy eager -r requirements.txt python manage.py collectstatic --noinput - name: Cache gulp output uses: actions/cache@v2 with: path: static/ key: static-${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }} - name: Basic Checks run: | pycodestyle . --exclude=migrations,node_modules python manage.py check python manage.py makemigrations --check --dry-run test: if: "!contains(github.event.head_commit.message, '[ci skip]')" needs: dependencies env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest strategy: matrix: test-group: ["RIGS", "versioning", "users", "assets"] steps: - name: Install Dependencies run: | python -m pip install --upgrade pip pip3 install --upgrade coverage coveralls django_coverage_plugin - name: Run Tests run: coverage run -p -m pytest --cov=${{ matrix.test-group }} --cov-append -n 8 ${{ matrix.test-group }}/tests/ - uses: actions/upload-artifact@v2 if: failure() with: name: failure-screenshots ${{ matrix.test-group }} path: screenshots/ retention-days: 5 - name: Upload Coverage run: coverage combine && coveralls --service=github env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_FLAG_NAME: ${{ matrix.test-group }} COVERALLS_PARALLEL: true coveralls: name: Indicate completion to coveralls.io needs: test runs-on: ubuntu-latest container: python:3-slim steps: - name: Finished run: | pip3 install --upgrade coveralls coveralls --service=github --finish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}