From 0d6ee759ef0278eff62bbf3d5f8c8ab88ea6942e Mon Sep 17 00:00:00 2001 From: "Gabriel R. Antunes" Date: Tue, 29 Oct 2024 16:59:11 -0400 Subject: [PATCH] chore: improve ci --- .changeset/config.json | 2 +- .github/actions/prepare/install/action.yml | 2 +- .github/workflows/build-push-deploy.yml | 59 ++++++++++--------- .github/workflows/generate-integrations.yml | 6 +- .github/workflows/release.yml | 10 +--- api-service/nest-cli.json | 2 +- ...766817-create-table-horario-gerado-aula.ts | 2 +- 7 files changed, 41 insertions(+), 42 deletions(-) diff --git a/.changeset/config.json b/.changeset/config.json index 7343bac3..857fb473 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -5,7 +5,7 @@ "fixed": [], "linked": [], "access": "restricted", - "baseBranch": "development", + "baseBranch": "next", "updateInternalDependencies": "patch", "ignore": [], "privatePackages": { diff --git a/.github/actions/prepare/install/action.yml b/.github/actions/prepare/install/action.yml index d5a18a4b..09e6d933 100644 --- a/.github/actions/prepare/install/action.yml +++ b/.github/actions/prepare/install/action.yml @@ -10,7 +10,7 @@ inputs: node-version: description: "The node version to setup" required: true - default: "22" + default: "23" node-registry-url: description: "Define registry-url" diff --git a/.github/workflows/build-push-deploy.yml b/.github/workflows/build-push-deploy.yml index 8d49f98c..5d8b257d 100644 --- a/.github/workflows/build-push-deploy.yml +++ b/.github/workflows/build-push-deploy.yml @@ -8,30 +8,26 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} env: - - CI_CD_LOCAL_API_SERVICE_IMAGE: registry.ladesa.local/api-service - CI_CD_LOCAL_API_NPM_FETCH_DOCS_IMAGE: registry.ladesa.local/api-client-fetch-docs - - CI_DEVELOPMENT_BRANCH: ${{ vars.CI_DEVELOPMENT_BRANCH }} - CI_PRODUCTION_BRANCH: ${{ vars.CI_PRODUCTION_BRANCH }} - + # USADOS ENABLE_BUILD_IMAGE: ${{ vars.ENABLE_BUILD_IMAGE }} - IMAGE_TAG_DEVELOPMENT: ${{ vars.IMAGE_TAG_DEVELOPMENT }} - IMAGE_TAG_PRODUCTION: ${{ vars.IMAGE_TAG_PRODUCTION }} - ENABLE_PUSH_IMAGE: ${{ vars.ENABLE_PUSH_IMAGE }} REGISTRY_URL: ${{ secrets.REGISTRY_URL }} REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} - IMAGE_NAME: ${{ vars.IMAGE_NAME }} - ENABLE_TRIGGER_DEPLOY: ${{ vars.ENABLE_TRIGGER_DEPLOY }} - DEPLOY_DISPATCH_TOKEN: ${{ secrets.DEPLOY_DISPATCH_TOKEN }} - DEPLOY_OWNER: ${{ vars.DEPLOY_OWNER }} - DEPLOY_REPOSITORY: ${{ vars.DEPLOY_REPOSITORY }} - DEPLOY_WORKFLOW: ${{ vars.DEPLOY_WORKFLOW }} - DEPLOY_BRANCH: ${{ vars.DEPLOY_BRANCH }} + IMAGE_TAG: ${{ github.ref_name }} + IMAGE_NAME_SERVICE: ${{ vars.IMAGE_NAME_SERVICE }} + IMAGE_NAME_DOCS_NPM_API_CLIENT_FETCH: ${{ vars.IMAGE_NAME_DOCS_NPM_API_CLIENT_FETCH }} + + # NAO USADOS + # ENABLE_TRIGGER_DEPLOY: ${{ vars.ENABLE_TRIGGER_DEPLOY }} + + # DEPLOY_DISPATCH_TOKEN: ${{ secrets.DEPLOY_DISPATCH_TOKEN }} + # DEPLOY_OWNER: ${{ vars.DEPLOY_OWNER }} + # DEPLOY_REPOSITORY: ${{ vars.DEPLOY_REPOSITORY }} + # DEPLOY_WORKFLOW: ${{ vars.DEPLOY_WORKFLOW }} + # DEPLOY_BRANCH: ${{ vars.DEPLOY_BRANCH }} jobs: build-and-push: @@ -49,26 +45,35 @@ jobs: username: ${{ env.REGISTRY_USERNAME }} password: ${{ env.REGISTRY_TOKEN }} - - name: Build @ladesa-ro/api.service locally + - name: Build and push @ladesa-ro/api.service if: ${{ env.ENABLE_BUILD_IMAGE == 'true' }} uses: docker/build-push-action@v6 with: - load: true - push: false + # loas is an alias for outputs: type=docker + # please refer to + # load: true + outputs: type=cacheonly + provenance: true + # platforms: amd64,linux/arm64,linux/arm/v7 + platforms: amd64 + push: ${{ env.ENABLE_PUSH_IMAGE == 'true' }} target: api-service - tags: ${{ env.CI_CD_LOCAL_API_SERVICE_IMAGE }} - file: "Dockerfile" + tags: ${{ env.REGISTRY_URL }}/${{ env.IMAGE_NAME_SERVICE }}:${{ env.IMAGE_TAG }} # cache-from: type=gha # cache-to: type=gha,mode=max - - name: Build @ladesa-ro/api-client-fetch-docs locally + - name: Build and push @ladesa-ro/api-client-fetch-docs if: ${{ env.ENABLE_BUILD_IMAGE == 'true' }} uses: docker/build-push-action@v6 with: - load: true - push: false + # DISABLED LOAD, THAT IS AN ALIAS FOR type=docker + # load: true + outputs: type=cacheonly + provenance: true + # platforms: amd64,linux/arm64,linux/arm/v7 + platforms: amd64 + push: ${{ env.ENABLE_PUSH_IMAGE == 'true' }} target: npm-api-client-fetch-docs - tags: ${{ env.CI_CD_LOCAL_API_NPM_FETCH_DOCS_IMAGE }} - file: "Dockerfile" + tags: ${{ env.REGISTRY_URL }}/${{ env.IMAGE_NAME_DOCS_NPM_API_CLIENT_FETCH }}:${{ env.IMAGE_TAG }} # cache-from: type=gha # cache-to: type=gha,mode=max diff --git a/.github/workflows/generate-integrations.yml b/.github/workflows/generate-integrations.yml index ad1f1386..7c3ae750 100644 --- a/.github/workflows/generate-integrations.yml +++ b/.github/workflows/generate-integrations.yml @@ -3,13 +3,12 @@ name: Generate Integrations on: push: branches: - - development + - next concurrency: ${{ github.workflow }}-${{ github.ref }} env: - node-version: 22 - target-branch: development + target-branch: next generated-branch: robozinho-do-ladesa/generated-integrations jobs: @@ -32,7 +31,6 @@ jobs: - name: Install uses: ./.github/actions/prepare/install with: - node-version: ${{ env.node-version }} install-node: "true" - id: build-integrations diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb59de7a..7e4f7852 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,14 +19,10 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Use Node.js ${{ env.node-version }} - uses: actions/setup-node@v4 + - name: Install + uses: ./.github/actions/prepare/install with: - node-version: ${{ env.node-version }} - cache: "pnpm" + install-node: "true" - name: Install dependencies run: pnpm install -w --frozen-lockfile diff --git a/api-service/nest-cli.json b/api-service/nest-cli.json index 579ca354..2245ad5b 100644 --- a/api-service/nest-cli.json +++ b/api-service/nest-cli.json @@ -5,6 +5,6 @@ "compilerOptions": { "deleteOutDir": true, "builder": "swc", - "typeCheck": true + "typeCheck": false } } diff --git a/api-service/src/infrastructure/integrations/database/typeorm/migrations/1710196766817-create-table-horario-gerado-aula.ts b/api-service/src/infrastructure/integrations/database/typeorm/migrations/1710196766817-create-table-horario-gerado-aula.ts index 9f8b040c..2eaffb24 100644 --- a/api-service/src/infrastructure/integrations/database/typeorm/migrations/1710196766817-create-table-horario-gerado-aula.ts +++ b/api-service/src/infrastructure/integrations/database/typeorm/migrations/1710196766817-create-table-horario-gerado-aula.ts @@ -1,6 +1,6 @@ import { MigrationInterface, QueryRunner, Table } from "typeorm"; -const tableName = "horario_gerado_aul"; +const tableName = "horario_gerado_aula"; export class CreateTableHorarioGeradoAula1710196766817 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise {