name: CI on: release: types: [ published ] push: branches: - master pull_request: branches: [ "master" ] jobs: backend: runs-on: ubuntu-latest defaults: run: working-directory: ./backend steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install uv run: curl -LsSf https://astral.sh/uv/install.sh | sh - name: Install dependencies run: | source ~/.cargo/env uv sync --group test - name: Lint with ruff run: | uv run ruff check . - name: Test with pytest run: | uv run pytest frontend: runs-on: ubuntu-latest defaults: run: working-directory: ./frontend 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: npm install - name: Lint with ESLint run: npm run lint - name: Test with Jest run: npm run test docker_publish_backend: runs-on: ubuntu-latest needs: backend if: github.event_name == 'release' || github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta for backend id: meta_backend uses: docker/metadata-action@v5 with: images: ghcr.io/leonmuscoden/letterfeed-backend tags: | type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} - name: Build and push a Docker image for backend uses: docker/build-push-action@v5 with: context: backend/ file: backend/Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta_backend.outputs.tags }} labels: ${{ steps.meta_backend.outputs.labels }} docker_publish_frontend: runs-on: ubuntu-latest needs: frontend if: github.event_name == 'release' || github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta for frontend id: meta_frontend uses: docker/metadata-action@v5 with: images: ghcr.io/leonmuscoden/letterfeed-frontend tags: | type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} - name: Build and push a Docker image for frontend uses: docker/build-push-action@v5 with: context: frontend/ file: frontend/Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta_frontend.outputs.tags }} labels: ${{ steps.meta_frontend.outputs.labels }}