diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 69855c64c..6197f750f 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -1,55 +1,55 @@ -name: Run Codegen - -on: - pull_request: - types: [opened, reopened, review_requested, ready_for_review, synchronize] - workflow_dispatch: - inputs: - api_branch: - description: Api Branch - required: true - default: 'main' - -jobs: - codegen: - if: github.event.pull_request.draft == false - name: Run Codegen - runs-on: ubuntu-latest - steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Checkout API Git repository - uses: actions/checkout@v4 - with: - repository: getlago/lago-api - ref: ${{ github.event.inputs.api_branch }} - path: api - token: ${{ secrets.GH_TOKEN }} - - - name: Build API local image - run: | - docker build -t getlago/api:ci ./api - - - name: Generate API RSA Key - run: | - echo "LAGO_RSA_PRIVATE_KEY=\"`openssl genrsa 2048 | base64`\"" >> .env - - - name: Launch API - run: docker compose -f ./ci/docker-compose.ci.yml --env-file ./.env up -d api - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install Node.js dependencies - run: yarn - - - name: Run codegen - env: - CODEGEN_API: http://localhost:3000/graphql - run: | - yarn codegen - - name: Run Typescript - run: yarn tsc \ No newline at end of file +# name: Run Codegen + +# on: +# pull_request: +# types: [opened, reopened, review_requested, ready_for_review, synchronize] +# workflow_dispatch: +# inputs: +# api_branch: +# description: Api Branch +# required: true +# default: 'main' + +# jobs: +# codegen: +# if: github.event.pull_request.draft == false +# name: Run Codegen +# runs-on: ubuntu-latest +# steps: +# - name: Check out Git repository +# uses: actions/checkout@v4 + +# - name: Checkout API Git repository +# uses: actions/checkout@v4 +# with: +# repository: getlago/lago-api +# ref: ${{ github.event.inputs.api_branch }} +# path: api +# token: ${{ secrets.GH_TOKEN }} + +# - name: Build API local image +# run: | +# docker build -t getlago/api:ci ./api + +# - name: Generate API RSA Key +# run: | +# echo "LAGO_RSA_PRIVATE_KEY=\"`openssl genrsa 2048 | base64`\"" >> .env + +# - name: Launch API +# run: docker compose -f ./ci/docker-compose.ci.yml --env-file ./.env up -d api + +# - name: Set up Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: 20 + +# - name: Install Node.js dependencies +# run: yarn + +# - name: Run codegen +# env: +# CODEGEN_API: http://localhost:3000/graphql +# run: | +# yarn codegen +# - name: Run Typescript +# run: yarn tsc \ No newline at end of file diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 72ebea82c..d8b1f6a33 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest env: ACTIONS_STEP_DEBUG: true + ACTIONS_RUNNER_DEBUG: true steps: - name: Check out Git repository uses: actions/checkout@v4 @@ -31,12 +32,15 @@ jobs: run: | docker build -t getlago/api:ci ./api + - name: Generate API RSA Key + run: | + echo "LAGO_RSA_PRIVATE_KEY=\"`openssl genrsa 2048 | base64`\"" >> .env + - name: Launch APP + API env: - LAGO_RSA_PRIVATE_KEY: ${{ secrets.LAGO_RSA_PRIVATE_KEY }} LAGO_LICENSE: ${{ secrets.LAGO_LICENSE }} run: | - docker compose -f ./ci/docker-compose.ci.yml up -d db redis api front + docker compose -f ./ci/docker-compose.ci.yml --env-file ./.env up -d db redis api front - name: Set up Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/lago-internal.yml b/.github/workflows/lago-internal.yml index 2a6a4eb88..9c99ef283 100644 --- a/.github/workflows/lago-internal.yml +++ b/.github/workflows/lago-internal.yml @@ -1,17 +1,17 @@ -name: "Lago Internal" -on: - push: - branches: - - main -jobs: - lago-internal: - name: Lago Internal - runs-on: ubuntu-latest - steps: - - name: Repository Dispatch - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.GH_TOKEN}} - repository: getlago/lago-deploy - event-type: front-push-main - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' \ No newline at end of file +# name: "Lago Internal" +# on: +# push: +# branches: +# - main +# jobs: +# lago-internal: +# name: Lago Internal +# runs-on: ubuntu-latest +# steps: +# - name: Repository Dispatch +# uses: peter-evans/repository-dispatch@v2 +# with: +# token: ${{ secrets.GH_TOKEN}} +# repository: getlago/lago-deploy +# event-type: front-push-main +# client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 23a200c94..ee1a979b9 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,35 +1,35 @@ -name: Lint +# name: Lint -on: - pull_request: - types: [opened, reopened, review_requested, ready_for_review, synchronize] +# on: +# pull_request: +# types: [opened, reopened, review_requested, ready_for_review, synchronize] -jobs: - run-linters: - name: Run linters - runs-on: ubuntu-latest - steps: - - name: Check out Git repository - uses: actions/checkout@v4 +# jobs: +# run-linters: +# name: Run linters +# runs-on: ubuntu-latest +# steps: +# - name: Check out Git repository +# uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 +# - name: Set up Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: 20 - # ESLint and Prettier must be in `package.json` - - name: Install Node.js dependencies - run: yarn +# # ESLint and Prettier must be in `package.json` +# - name: Install Node.js dependencies +# run: yarn - - name: Run linters - uses: wearerequired/lint-action@v2 - with: - eslint: true - eslint_extensions: js,ts,tsx - continue_on_error: false - prettier: true - prettier_extensions: ts,tsx,svg,html +# - name: Run linters +# uses: wearerequired/lint-action@v2 +# with: +# eslint: true +# eslint_extensions: js,ts,tsx +# continue_on_error: false +# prettier: true +# prettier_extensions: ts,tsx,svg,html - - name: Run Translation Check - run: | - yarn translations:inspect \ No newline at end of file +# - name: Run Translation Check +# run: | +# yarn translations:inspect \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68baf279c..ce252dbcb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,126 +1,126 @@ -name: Release -on: - release: - types: [released] - workflow_dispatch: - inputs: - version: - description: Version - required: true -env: - REGISTRY_IMAGE: getlago/front -jobs: - build-images: - strategy: - matrix: - platform: - - linux/amd64 - - linux/arm64 - name: Build ${{ matrix.platform }} Image - runs-on: ${{ matrix.platform }} - steps: - - name: Prepare - run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Docker Meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=raw,value=${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: latest - - - name: Log In to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Add version into docker image - id: add_version - run: | - echo "${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }}" > LAGO_VERSION - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - id: build - with: - context: . - platforms: ${{ matrix.platform }} - labels: ${{ steps.meta.outputs.label }} - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - - - name: Export Digest - run: | - mkdir -p ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests/${digest#sha256:}" - - - name: Upload Digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ env.PLATFORM_PAIR }} - path: ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests/* - if-no-files-found: error - retention-days: 1 - - - name: Clean up - if: always() - run: | - [ -e ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests ] && \ - rm -rf ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests - - merge: - name: Merge Images - runs-on: lago-runner - needs: [build-images] - steps: - - name: Download Digests - uses: actions/download-artifact@v4 - with: - path: ./_tmp/${{ github.run_id}}/${{ github.run_attempt }}/digests - pattern: digests-* - merge-multiple: true - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=raw,value=${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }} - - - name: Set up Docker buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Create manifest and push - working-directory: ./_tmp/${{ github.run_id }}/${{ github.run_attempt}}/digests - run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - - - name: Inspect Image - run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} - - - name: Clean up - if: always() - run: | - [ -e ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests ] && \ - rm -rf ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests +# name: Release +# on: +# release: +# types: [released] +# workflow_dispatch: +# inputs: +# version: +# description: Version +# required: true +# env: +# REGISTRY_IMAGE: getlago/front +# jobs: +# build-images: +# strategy: +# matrix: +# platform: +# - linux/amd64 +# - linux/arm64 +# name: Build ${{ matrix.platform }} Image +# runs-on: ${{ matrix.platform }} +# steps: +# - name: Prepare +# run: | +# platform=${{ matrix.platform }} +# echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + +# - name: Checkout Repository +# uses: actions/checkout@v4 + +# - name: Docker Meta +# id: meta +# uses: docker/metadata-action@v5 +# with: +# images: ${{ env.REGISTRY_IMAGE }} +# tags: | +# type=raw,value=${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }} + +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# with: +# version: latest + +# - name: Log In to Docker Hub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_PASSWORD }} + +# - name: Add version into docker image +# id: add_version +# run: | +# echo "${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }}" > LAGO_VERSION + +# - name: Build and push Docker image +# uses: docker/build-push-action@v6 +# id: build +# with: +# context: . +# platforms: ${{ matrix.platform }} +# labels: ${{ steps.meta.outputs.label }} +# outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true + +# - name: Export Digest +# run: | +# mkdir -p ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests +# digest="${{ steps.build.outputs.digest }}" +# touch "./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests/${digest#sha256:}" + +# - name: Upload Digest +# uses: actions/upload-artifact@v4 +# with: +# name: digests-${{ env.PLATFORM_PAIR }} +# path: ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests/* +# if-no-files-found: error +# retention-days: 1 + +# - name: Clean up +# if: always() +# run: | +# [ -e ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests ] && \ +# rm -rf ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests + +# merge: +# name: Merge Images +# runs-on: lago-runner +# needs: [build-images] +# steps: +# - name: Download Digests +# uses: actions/download-artifact@v4 +# with: +# path: ./_tmp/${{ github.run_id}}/${{ github.run_attempt }}/digests +# pattern: digests-* +# merge-multiple: true + +# - name: Docker meta +# id: meta +# uses: docker/metadata-action@v5 +# with: +# images: ${{ env.REGISTRY_IMAGE }} +# tags: | +# type=raw,value=${{ github.event_name == 'release' && github.event.release.tag_name || github.event.inputs.version }} + +# - name: Set up Docker buildx +# uses: docker/setup-buildx-action@v3 + +# - name: Log in to Docker Hub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_PASSWORD }} + +# - name: Create manifest and push +# working-directory: ./_tmp/${{ github.run_id }}/${{ github.run_attempt}}/digests +# run: | +# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ +# $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + +# - name: Inspect Image +# run: | +# docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + +# - name: Clean up +# if: always() +# run: | +# [ -e ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests ] && \ +# rm -rf ./_tmp/${{ github.run_id }}/${{ github.run_attempt }}/digests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5d1ab75c1..bc6153c04 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,26 +1,26 @@ -name: Tests +# name: Tests -on: - pull_request: - types: [opened, reopened, review_requested, ready_for_review, synchronize] +# on: +# pull_request: +# types: [opened, reopened, review_requested, ready_for_review, synchronize] -jobs: - run-tests: - if: github.event.pull_request.draft == false - name: Run tests - runs-on: ubuntu-latest - steps: - - name: Check out Git repository - uses: actions/checkout@v4 +# jobs: +# run-tests: +# if: github.event.pull_request.draft == false +# name: Run tests +# runs-on: ubuntu-latest +# steps: +# - name: Check out Git repository +# uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 +# - name: Set up Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: 20 - - name: Install Node.js dependencies - run: yarn +# - name: Install Node.js dependencies +# run: yarn - - name: Run tests - run: | - yarn test +# - name: Run tests +# run: | +# yarn test diff --git a/ci/docker-compose.ci.yml b/ci/docker-compose.ci.yml index 053c06635..8e7e4114b 100644 --- a/ci/docker-compose.ci.yml +++ b/ci/docker-compose.ci.yml @@ -31,7 +31,7 @@ services: ports: - 3000:3000 environment: - RAILS_ENV: production + RAILS_ENV: staging DATABASE_URL: postgres://lago:lago@db:5432/lago REDIS_URL: redis://redis:6379 LAGO_FRONT_URL: http://localhost