fix: preserve [[...]] wikilinks through Milkdown editor roundtrip. #12
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: CI/CD | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: ['v*'] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - 'screenshots/**' | |
| - '.gitignore' | |
| - 'LICENSE' | |
| - 'to-do.md' | |
| pull_request: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - 'screenshots/**' | |
| - '.gitignore' | |
| - 'LICENSE' | |
| - 'to-do.md' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_PREFIX: ghcr.io/${{ github.repository }} | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backend: ${{ steps.filter.outputs.backend }} | |
| frontend: ${{ steps.filter.outputs.frontend }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| backend: | |
| - 'backend/**' | |
| - 'VERSION' | |
| - '.github/workflows/ci.yml' | |
| - 'docker-compose.yml' | |
| frontend: | |
| - 'frontend/**' | |
| - 'VERSION' | |
| - '.github/workflows/ci.yml' | |
| - 'docker-compose.yml' | |
| backend-tests: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.backend == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: | | |
| cd backend | |
| uv venv | |
| uv pip install -r requirements.txt -r requirements-dev.txt pytest-cov | |
| - name: Run tests with coverage | |
| run: | | |
| cd backend | |
| source .venv/bin/activate | |
| export PYTHONPATH=$PYTHONPATH:. | |
| pytest --cov=app --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./backend/coverage.xml | |
| flags: backend | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| continue-on-error: true | |
| frontend-tests: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.frontend == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Lint | |
| run: | | |
| cd frontend | |
| npm run lint | |
| - name: Run tests with coverage | |
| run: | | |
| cd frontend | |
| npm test -- --coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./frontend/coverage/clover.xml | |
| flags: frontend | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| continue-on-error: true | |
| build-and-push: | |
| needs: [changes, backend-tests, frontend-tests] | |
| if: | | |
| always() && | |
| github.event_name != 'pull_request' && | |
| (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && | |
| (needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true') && | |
| (needs.backend-tests.result == 'success' || needs.backend-tests.result == 'skipped') && | |
| (needs.frontend-tests.result == 'success' || needs.frontend-tests.result == 'skipped') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| component: [backend, frontend] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Skip if component didn't change | |
| id: check | |
| run: | | |
| if [[ "${{ matrix.component }}" == "backend" && "${{ needs.changes.outputs.backend }}" != "true" ]]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| elif [[ "${{ matrix.component }}" == "frontend" && "${{ needs.changes.outputs.frontend }}" != "true" ]]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up Docker Buildx | |
| if: steps.check.outputs.skip != 'true' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| if: steps.check.outputs.skip != 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| if: steps.check.outputs.skip != 'true' | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_PREFIX }}/${{ matrix.component }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,prefix= | |
| - name: Build and push ${{ matrix.component }} | |
| if: steps.check.outputs.skip != 'true' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./${{ matrix.component }}/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |