diff --git a/.gitea/workflow/ci.yml b/.gitea/workflow/ci.yml deleted file mode 100644 index 8f5c045..0000000 --- a/.gitea/workflow/ci.yml +++ /dev/null @@ -1,135 +0,0 @@ -name: CI - -on: - push: - branches: [main, develop] - pull_request: - branches: [main] - workflow_dispatch: - inputs: - environment: - description: "Environment to deploy" - required: true - default: "staging" - type: choice - options: - - staging - - production - -jobs: - test: - runs-on: ubuntu-latest - services: - postgres: - image: postgres:16-alpine - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: dofus_manager - ports: - - 5432:5432 - options: >- - --health-cmd "pg_isready -U postgres" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - steps: - - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v4 - with: - version: 9 - - - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "pnpm" - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Generate Prisma client - run: pnpm prisma generate - - - name: Run migrations - run: pnpm prisma migrate deploy - env: - DATABASE_URL: postgresql://postgres:postgres@localhost:5432/dofus_manager - - - name: Lint - run: pnpm lint - - - name: Type check - run: pnpm typecheck - - - name: Test - run: pnpm test - env: - DATABASE_URL: postgresql://postgres:postgres@localhost:5432/dofus_manager - - build: - needs: test - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' - - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Registry - uses: docker/login-action@v3 - with: - registry: ${{ vars.REGISTRY_URL }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - file: docker/Dockerfile - push: true - tags: | - ${{ vars.REGISTRY_URL }}/dofus-manager:${{ github.sha }} - ${{ vars.REGISTRY_URL }}/dofus-manager:latest - cache-from: type=gha - cache-to: type=gha,mode=max - - deploy-staging: - needs: build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/develop' - environment: staging - - steps: - - name: Deploy to staging - run: | - echo "Deploying to staging..." - # SSH ou webhook vers votre serveur staging - curl -X POST "${{ secrets.STAGING_WEBHOOK_URL }}" || true - - deploy-production: - needs: build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - environment: production - - steps: - - name: Deploy to production - run: | - echo "Deploying to production..." - curl -X POST "${{ secrets.PRODUCTION_WEBHOOK_URL }}" || true - - deploy-manual: - runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' - environment: ${{ github.event.inputs.environment }} - - steps: - - name: Deploy to ${{ github.event.inputs.environment }} - run: | - echo "Manual deploy to ${{ github.event.inputs.environment }}" - # Votre logique de déploiement ici diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..e27057b --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,134 @@ +name: CI + +on: + push: + branches: [main, develop] + pull_request: + branches: [main] + workflow_dispatch: + inputs: + environment: + description: 'Environment to deploy' + required: true + default: 'staging' + type: choice + options: + - staging + - production + +jobs: + test: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: dofus_manager + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Generate Prisma client + run: pnpm prisma generate + + - name: Run migrations + run: pnpm prisma migrate deploy + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/dofus_manager + + - name: Lint + run: pnpm lint + + - name: Type check + run: pnpm typecheck + + - name: Test + run: pnpm test + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/dofus_manager + + build: + needs: test + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Registry + uses: docker/login-action@v3 + with: + registry: ${{ vars.REGISTRY_URL }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/Dockerfile + push: true + tags: | + ${{ vars.REGISTRY_URL }}/theo/dofus-manager:${{ github.sha }} + ${{ vars.REGISTRY_URL }}/theo/dofus-manager:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + deploy-staging: + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/develop' + environment: staging + + steps: + - name: Deploy to staging + run: | + echo "Deploying to staging..." + curl -X POST "${{ secrets.STAGING_WEBHOOK_URL }}" || true + + deploy-production: + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + environment: production + + steps: + - name: Deploy to production + run: | + echo "Deploying to production..." + curl -X POST "${{ secrets.PRODUCTION_WEBHOOK_URL }}" || true + + deploy-manual: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' + environment: ${{ github.event.inputs.environment }} + + steps: + - name: Deploy to ${{ github.event.inputs.environment }} + run: | + echo "Manual deploy to ${{ github.event.inputs.environment }}" + # Ajoutez votre logique de déploiement ici