GitHub User Experience Enahncement #44
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: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| js-tests: | |
| permissions: | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| working-directory: cloudpebble/ide/static/ide/js | |
| run: npm install | |
| - name: Run tests with coverage | |
| working-directory: cloudpebble/ide/static/ide/js | |
| run: npx vitest run --coverage | |
| - name: Code Coverage Summary | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: cloudpebble/ide/static/ide/js/coverage/cobertura-coverage.xml | |
| badge: true | |
| format: markdown | |
| output: both | |
| - name: Add Coverage PR Comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| header: js-coverage | |
| - name: Write to Job Summary | |
| run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY | |
| run-tests: | |
| permissions: | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build and run tests with coverage | |
| run: | | |
| sed -i 's|^NGINX_PORT=.*|NGINX_PORT=8080|' .env | |
| sed -i 's|^PUBLIC_URL=.*|PUBLIC_URL=http://localhost:8080|' .env | |
| docker compose build | |
| docker compose up -d | |
| # Wait for web to be ready | |
| sleep 10 | |
| docker compose exec -T web coverage run manage.py test | |
| docker compose exec -T web coverage xml -o /tmp/python-coverage.xml | |
| docker compose cp web:/tmp/python-coverage.xml python-coverage.xml | |
| - name: Python Code Coverage Summary | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: python-coverage.xml | |
| badge: true | |
| format: markdown | |
| output: both | |
| - name: Add Coverage PR Comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| header: python-coverage | |
| - name: Write to Job Summary | |
| run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY |