From 6296a91c3d7c3042e4b4f427571deb91b5471678 Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Tue, 5 May 2026 22:59:49 -0400 Subject: [PATCH] chore(ci): run CI tests in isolated workspace --- .gitea/workflows/deploy-socialize.yml | 34 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/deploy-socialize.yml b/.gitea/workflows/deploy-socialize.yml index dc67ecc..2e9940d 100644 --- a/.gitea/workflows/deploy-socialize.yml +++ b/.gitea/workflows/deploy-socialize.yml @@ -7,18 +7,36 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: bookworm steps: - uses: actions/checkout@v4 - - name: Install Docker CLI - run: apt-get update && apt-get install -y docker.io + - name: Install SSH client + run: apt-get update && apt-get install -y openssh-client - name: Test backend + env: + DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} + DEPLOY_USER: ${{ secrets.DEPLOY_USER }} + DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} run: | - docker run --rm \ - -v "$PWD:/workspace" \ - -w /workspace \ - mcr.microsoft.com/dotnet/sdk:10.0 \ - dotnet test backend/Socialize.slnx + mkdir -p ~/.ssh + printf '%s\n' "$DEPLOY_SSH_PRIVATE_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + + tar \ + --exclude=.git \ + --exclude='**/bin' \ + --exclude='**/obj' \ + --exclude='**/node_modules' \ + --exclude=frontend/dist \ + --exclude=frontend/dist-ssr \ + -czf - . | ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new "$DEPLOY_USER@$DEPLOY_HOST" \ + "set -Eeuo pipefail + workdir=/tmp/socialize-ci/${{ gitea.sha }} + rm -rf \"\$workdir\" + mkdir -p \"\$workdir\" + tar -xzf - -C \"\$workdir\" + cd \"\$workdir\" + dotnet test backend/Socialize.slnx" image: needs: test