From 6c0692c9edb102baf72abe458ef04967343fc84c Mon Sep 17 00:00:00 2001 From: zk Date: Thu, 30 Apr 2026 21:16:08 +0000 Subject: [PATCH] hajnal --- .github/workflows/client.yml | 32 ++++++++--------- .github/workflows/common.yml | 7 ++-- .github/workflows/database-seeds.yml | 7 ++-- .github/workflows/dev-image.yml | 53 ++++++++++++++++++++++++++++ .github/workflows/homepage.yml | 10 ++---- .github/workflows/seeds-webui.yml | 15 ++++---- .github/workflows/server.yml | 18 +++++----- 7 files changed, 92 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/dev-image.yml diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 36ee56fe0..f53fb6d60 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -24,15 +24,14 @@ permissions: jobs: test: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" - - name: Install dependencies run: bun install --frozen-lockfile @@ -44,6 +43,9 @@ jobs: build: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root needs: test if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }} steps: @@ -51,10 +53,6 @@ jobs: with: persist-credentials: false - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" - - name: Install dependencies run: bun install --frozen-lockfile @@ -69,7 +67,7 @@ jobs: VITE_DISCORD: "https://discord.gg/E4n8ZZF5ES" VITE_CDN_URL: "https://cdn-boku.tachi.ac" TACHI_NAME: "Bokutachi" - BUILD_OUT_DIR: /home/runner/boku + BUILD_OUT_DIR: /tmp/boku - name: Build Kamaitachi (v3) run: bun run --filter tachi-client build @@ -86,7 +84,7 @@ jobs: VITE_GIT_REPO: "GitHub:zkldi/Tachi" VITE_RECAPTCHA_KEY: "6LcsYbIpAAAAAEJffjIXmbQcxj_SBZG7BnSPjF4L" TACHI_NAME: "Kamaitachi" - BUILD_OUT_DIR: /home/runner/kamai + BUILD_OUT_DIR: /tmp/kamai - name: Build Dev run: bun run --filter tachi-client build @@ -99,10 +97,10 @@ jobs: VITE_GIT_REPO: "GitHub:zkldi/Tachi" VITE_RECAPTCHA_KEY: "6LcsYbIpAAAAAEJffjIXmbQcxj_SBZG7BnSPjF4L" TACHI_NAME: "Tachi Dev" - BUILD_OUT_DIR: /home/runner/dev + BUILD_OUT_DIR: /tmp/dev - name: Bundle build outputs - run: tar -C /home/runner -czf client-builds.tgz boku kamai dev + run: tar -C /tmp -czf client-builds.tgz boku kamai dev - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: @@ -124,8 +122,8 @@ jobs: - name: Unpack build outputs run: | - mkdir -p /home/runner/boku /home/runner/kamai /home/runner/dev - tar -C /home/runner -xzf client-builds.tgz + mkdir -p /tmp/boku /tmp/kamai /tmp/dev + tar -C /tmp -xzf client-builds.tgz - name: Enable SSH Key env: @@ -141,6 +139,6 @@ jobs: env: TACHI_HOST: ${{ secrets.TACHI_HOST }} run: | - rsync --recursive --compress --delete --progress /home/runner/kamai/. "ci@${TACHI_HOST}:/srv/tachi-static/kamai/" - rsync --recursive --compress --delete --progress /home/runner/boku/. "ci@${TACHI_HOST}:/srv/tachi-static/boku/" - rsync --recursive --compress --delete --progress /home/runner/dev/. "ci@${TACHI_HOST}:/srv/tachi-static/dev/" + rsync --recursive --compress --delete --progress /tmp/kamai/. "ci@${TACHI_HOST}:/srv/tachi-static/kamai/" + rsync --recursive --compress --delete --progress /tmp/boku/. "ci@${TACHI_HOST}:/srv/tachi-static/boku/" + rsync --recursive --compress --delete --progress /tmp/dev/. "ci@${TACHI_HOST}:/srv/tachi-static/dev/" diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index c2029d54b..6d0a5c321 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -21,16 +21,15 @@ permissions: jobs: test: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root steps: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" - - name: Install dependencies run: bun install --frozen-lockfile diff --git a/.github/workflows/database-seeds.yml b/.github/workflows/database-seeds.yml index d7285a872..068a021b4 100644 --- a/.github/workflows/database-seeds.yml +++ b/.github/workflows/database-seeds.yml @@ -25,16 +25,15 @@ permissions: jobs: test: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root steps: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" - - name: Install dependencies run: bun install --frozen-lockfile diff --git a/.github/workflows/dev-image.yml b/.github/workflows/dev-image.yml new file mode 100644 index 000000000..067314c24 --- /dev/null +++ b/.github/workflows/dev-image.yml @@ -0,0 +1,53 @@ +name: Dev Image + +on: + push: + branches: + - "main" + paths: + - "Dockerfile.dev" + - ".github/workflows/dev-image.yml" + pull_request: + branches: + - "main" + paths: + - "Dockerfile.dev" + - ".github/workflows/dev-image.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: "dev-image-${{ github.ref }}" + cancel-in-progress: true + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Log in to Docker Hub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + + - name: Build and push + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 + with: + context: . + file: Dockerfile.dev + push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + tags: | + zkldi/tachi-dev:main + zkldi/tachi-dev:${{ github.sha }} + cache-from: type=gha,scope=dev-image + cache-to: type=gha,mode=max,scope=dev-image diff --git a/.github/workflows/homepage.yml b/.github/workflows/homepage.yml index 6dd09d3a5..ba194d79f 100644 --- a/.github/workflows/homepage.yml +++ b/.github/workflows/homepage.yml @@ -15,6 +15,9 @@ permissions: jobs: deploy: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }} steps: - name: Checkout @@ -22,13 +25,6 @@ jobs: with: persist-credentials: false - - name: Install rsync - run: sudo apt-get update && sudo apt-get install -y rsync - - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" - - name: Install dependencies run: bun install --frozen-lockfile diff --git a/.github/workflows/seeds-webui.yml b/.github/workflows/seeds-webui.yml index 94d222cb1..3de43b9be 100644 --- a/.github/workflows/seeds-webui.yml +++ b/.github/workflows/seeds-webui.yml @@ -25,15 +25,14 @@ permissions: jobs: build: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" - - name: Install dependencies run: bun install --frozen-lockfile @@ -46,11 +45,11 @@ jobs: - name: Production build run: bun run --filter tachi-seeds-webui build env: - BUILD_OUT_DIR: /home/runner/seeds-webui + BUILD_OUT_DIR: /tmp/seeds-webui - name: Bundle build output if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: tar -C /home/runner -czf seeds-webui.tgz seeds-webui + run: tar -C /tmp -czf seeds-webui.tgz seeds-webui - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 if: github.ref == 'refs/heads/main' && github.event_name == 'push' @@ -72,7 +71,7 @@ jobs: name: seeds-webui - name: Unpack build output - run: tar -C /home/runner -xzf seeds-webui.tgz + run: tar -C /tmp -xzf seeds-webui.tgz - name: Enable SSH env: @@ -87,4 +86,4 @@ jobs: - name: Deploy static to seeds.tachi.ac root env: TACHI_HOST: ${{ secrets.TACHI_HOST }} - run: rsync --recursive --compress --delete --progress /home/runner/seeds-webui/. "ci@${TACHI_HOST}:/srv/tachi-static/seeds/" + run: rsync --recursive --compress --delete --progress /tmp/seeds-webui/. "ci@${TACHI_HOST}:/srv/tachi-static/seeds/" diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 63bc71e58..ac0684e8a 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -35,13 +35,14 @@ concurrency: jobs: test: runs-on: ubuntu-latest + container: + image: zkldi/tachi-dev:main + options: --user root env: NODE_ENV: "test" services: tachi-postgres: image: postgres:16 - ports: - - 5432:5432 env: POSTGRES_USER: tachi POSTGRES_PASSWORD: tachi @@ -53,8 +54,6 @@ jobs: --health-retries 10 tachi-redis: image: redis:7.4-alpine - ports: - - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 5s @@ -62,8 +61,6 @@ jobs: --health-retries 10 tachi-s3: image: quay.io/minio/minio:RELEASE.2024-10-29T16-01-48Z - ports: - - 9000:9000 env: MINIO_ROOT_USER: minio MINIO_ROOT_PASSWORD: password @@ -72,9 +69,11 @@ jobs: with: persist-credentials: false - - uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2 - with: - bun-version: "1.2.20" + - name: Link workspace to /tachi + # tachidb, just recipes, and .env.test all assume the repo lives at /tachi. + # GHA mounts the workspace elsewhere, so we replace the empty /tachi dir + # (created by the image's WORKDIR) with a symlink to the real checkout. + run: rm -rf /tachi && ln -sf "$GITHUB_WORKSPACE" /tachi - name: Install dependencies run: bun install --frozen-lockfile @@ -90,7 +89,6 @@ jobs: env: NODE_ENV: "test" PORT: 8080 - REDIS_URL: "redis://localhost:6379" docker-push: runs-on: ubuntu-latest