MDのアラートの修正と codecov の設定ファイルの追加 #4
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: Run tests and upload coverage | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| force_run: | |
| description: "Force run even if no changes are detected" | |
| required: false | |
| default: "false" | |
| jobs: | |
| backend: | |
| name: Test backend | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check for changes - Push | |
| id: changes-push | |
| if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' | |
| run: | | |
| git fetch origin ${{ github.ref_name }} --depth=1 | |
| if git diff --quiet origin/${{ github.ref_name }} -- backend; then | |
| echo "skip=true" >> $GITHUB_ENV | |
| fi | |
| - name: Check for changes - Pull Request | |
| id: changes-pullreq | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| git fetch origin ${{ github.base_ref }} --depth=1 | |
| if git diff --quiet origin/${{ github.base_ref }}...HEAD -- backend; then | |
| echo "skip=true" >> $GITHUB_ENV | |
| fi | |
| - name: Override skip with manual flag | |
| if: github.event_name == 'workflow_dispatch' && inputs.force_run == 'true' | |
| run: echo "skip=false" >> $GITHUB_ENV | |
| - name: Set up Node | |
| if: env.skip != 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Set up pnpm | |
| if: env.skip != 'true' | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Install dependencies | |
| if: env.skip != 'true' | |
| run: pnpm install | |
| - name: Run tests with coverage | |
| if: env.skip != 'true' | |
| run: pnpm coverage | |
| - name: Upload coverage to Codecov | |
| if: env.skip != 'true' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: scratchcore/scratch-status-monitor | |
| files: ./coverage/lcov.info | |
| flags: backend | |
| name: backend | |
| verbose: true |