From 08c94102bf406372e36bdb83bc25e2b5f0aa1ffe Mon Sep 17 00:00:00 2001 From: bq Date: Fri, 29 May 2026 15:01:53 +0200 Subject: [PATCH] use depot --- .depot/workflows/cicd.yml | 85 +++++++++++++++++++++ .github/workflows/cicd.yml | 152 ------------------------------------- Dockerfile | 4 +- 3 files changed, 87 insertions(+), 154 deletions(-) create mode 100644 .depot/workflows/cicd.yml delete mode 100644 .github/workflows/cicd.yml diff --git a/.depot/workflows/cicd.yml b/.depot/workflows/cicd.yml new file mode 100644 index 000000000..c31dd88d8 --- /dev/null +++ b/.depot/workflows/cicd.yml @@ -0,0 +1,85 @@ +name: ci&cd + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + runs-on: depot-ubuntu-24.04 + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 26 + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 + with: + cache: true + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - parallel: + - name: build + run: node --run build + - name: build docs + run: node --run docs + - name: lint + run: node --run lint + - name: check formatting + run: node --run lint:fmt + - name: test + env: + NODE_ENV: test + run: node --run test + - name: typecheck + run: node --run typecheck + + docker: + needs: [ci] + runs-on: depot-ubuntu-24.04 + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Docker meta + id: meta + uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=raw,value={{sha}} + type=raw,value=latest + + - name: Login to GHCR + if: github.ref == 'refs/heads/main' + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and maybe Push Docker image + uses: depot/build-push-action@98e78adca7817480b8185f474a400b451d74e287 # v1.18.0 + with: + project: ks849krng9 + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml deleted file mode 100644 index 54816bfb5..000000000 --- a/.github/workflows/cicd.yml +++ /dev/null @@ -1,152 +0,0 @@ -name: ci&cd - -on: - push: - branches: - - main - pull_request: - -permissions: - contents: read - -concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true - -jobs: - lint: - runs-on: ubuntu-24.04-arm - - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 26 - - - name: find pnpm cache path - id: cache - run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT" - - - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ${{ steps.cache.outputs.path }} - key: v1-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - v1-pnpm- - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - run: node --run lint - - - run: node --run lint:fmt - - typecheck: - runs-on: ubuntu-24.04-arm - - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 26 - - - name: find pnpm cache path - id: cache - run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT" - - - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ${{ steps.cache.outputs.path }} - key: v1-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - v1-pnpm- - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - run: node --run typecheck - - test: - runs-on: ubuntu-24.04-arm - - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 26 - - - name: find pnpm cache path - id: cache - run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT" - - - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ${{ steps.cache.outputs.path }} - key: v1-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - v1-pnpm- - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - run: node --run test - env: - NODE_ENV: test - - build: - runs-on: ubuntu-24.04-arm - permissions: - contents: read - packages: write - id-token: write - - steps: - - name: Docker meta - id: meta - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 - with: - images: | - ghcr.io/${{ github.repository }} - tags: | - type=raw,value={{sha}} - type=raw,value=latest - - - name: Login to GHCR - if: github.ref == 'refs/heads/main' - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and maybe Push Docker image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 - with: - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - #cache-from: type=gha - #cache-to: type=gha,mode=max - - deploy: - if: github.ref == 'refs/heads/main' - needs: [lint, test, typecheck, build] - runs-on: ubuntu-slim - environment: - name: prod - url: https://arm.haglund.dev/api - - steps: - - run: echo 'Deployed! :)' diff --git a/Dockerfile b/Dockerfile index ec6a12be9..1b75718ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN corepack enable RUN corepack prepare --activate # Install dependencies -RUN --mount=type=cache,id=s/c47f3895-fff0-42c4-b1f7-cee7f61e6613-pnpm,target=/pnpm/store \ +RUN --mount=type=cache,target=/pnpm/store \ pnpm install --frozen-lockfile --ignore-scripts FROM base_deps AS build @@ -37,7 +37,7 @@ FROM base_deps AS docs COPY docs/openapi.yaml docs/openapi.yaml -RUN --mount=type=cache,id=s/c47f3895-fff0-42c4-b1f7-cee7f61e6613-pnpm,target=/pnpm/store \ +RUN --mount=type=cache,target=/pnpm/store \ node --run docs FROM base