Something went wrong. Try again.
Code Review Workflow for IT Programming at BCTC West
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103name: Tests
on: workflow_dispatch: pull_request: paths-ignore: - "docs/**" - "*.md" - ".gitignore" - "coverage.svg" - "concept/**" branches: [ master ] push: paths-ignore: - "docs/**" - "*.md" - ".gitignore" - "coverage.svg" - "concept/**" branches: [ master ]
env: STAGE: GH_TEST PIPENV_VENV_IN_PROJECT: enabled EMAIL_DOMAIN: actions.com EMAIL_ADMIN_DOMAIN: admin.actions.com LDAP_DOMAIN: ACTIONSLDAP LDAP_BASE_CONTEXT: dc=actions,dc=com LDAP_ADMIN_USER: ACTIONSLDAP\admin
jobs: run_tests: name: Run Django Tests runs-on: ubuntu-latest services: db: image: postgres:12.3-alpine env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: github_actions ports: - 5432:5432 options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout uses: actions/checkout@v3
- run: mkdir .venv
- name: Cache Dependencies uses: actions/cache@v3 id: cache-dependencies with: path: ./.venv key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }} restore-keys: | ${{ runner.os }}-pipenv
- name: Install Dependecies uses: VaultVulp/action-pipenv@v2.0.1 with: command: sync --dev
- name: Run tests uses: VaultVulp/action-pipenv@v2.0.1 with: command: run coverage run
- name: Generate XML uses: VaultVulp/action-pipenv@v2.0.1 with: command: run coverage xml
- name: Generate Badge uses: VaultVulp/action-pipenv@v2.0.1 with: command: run genbadge coverage -i coverage.xml -o coverage.svg
- name: Verify Changed files if: github.ref == 'refs/heads/master' uses: tj-actions/verify-changed-files@v17 id: changed_files with: files: coverage.svg
- name: Commit files if: steps.changed_files.outputs.files_changed == 'true' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add coverage.svg git commit -m "Updated coverage.svg"
- name: Push changes if: steps.changed_files.outputs.files_changed == 'true' && github.ref == 'refs/heads/master' uses: ad-m/github-push-action@master with: github_token: ${{ secrets.github_token }} branch: ${{ github.ref }}