diff --git a/.github/workflows/tests-backend.yml b/.github/workflows/tests-backend.yml new file mode 100644 index 0000000000..fb58ed7ea4 --- /dev/null +++ b/.github/workflows/tests-backend.yml @@ -0,0 +1,84 @@ +name: "CI: Backend" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'backend/**' + - 'common/**' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'backend/**' + - 'common/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-backend: + if: ${{ !github.event.pull_request.draft }} + name: "Backend Tests" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + services: + postgres: + image: postgres:17 + # Provide the password for postgres + env: + POSTGRES_USER: penpot_test + POSTGRES_PASSWORD: penpot_test + POSTGRES_DB: penpot_test + + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + redis: + image: valkey/valkey:9 + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Lint + working-directory: ./backend + run: | + corepack enable; + corepack install; + pnpm install; + pnpm run check-fmt + pnpm run lint + + - name: Tests + working-directory: ./backend + env: + PENPOT_TEST_DATABASE_URI: "postgresql://postgres/penpot_test" + PENPOT_TEST_DATABASE_USERNAME: penpot_test + PENPOT_TEST_DATABASE_PASSWORD: penpot_test + PENPOT_TEST_REDIS_URI: "redis://redis/1" + + run: | + mkdir -p /tmp/penpot; + clojure -M:dev:test --reporter kaocha.report/documentation diff --git a/.github/workflows/tests-common.yml b/.github/workflows/tests-common.yml new file mode 100644 index 0000000000..5996c82742 --- /dev/null +++ b/.github/workflows/tests-common.yml @@ -0,0 +1,57 @@ +name: "CI: Common" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'common/**' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'common/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-common: + if: ${{ !github.event.pull_request.draft }} + name: "Common Tests" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Lint + working-directory: ./common + run: | + corepack enable; + corepack install; + pnpm install; + pnpm run check-fmt:clj + pnpm run check-fmt:js + pnpm run lint:clj + + - name: Tests + working-directory: ./common + run: | + ./scripts/test diff --git a/.github/workflows/tests-frontend.yml b/.github/workflows/tests-frontend.yml new file mode 100644 index 0000000000..a922922f22 --- /dev/null +++ b/.github/workflows/tests-frontend.yml @@ -0,0 +1,71 @@ +name: "CI: Frontend" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'frotend/**/*' + - 'common/**/*' + - 'render-wasm/**/*' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'frotend/**' + - 'common/**' + - 'render-wasm/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-frontend: + if: ${{ !github.event.pull_request.draft }} + name: "Frontend Tests" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Lint + working-directory: ./frontend + run: | + corepack enable; + corepack install; + pnpm install; + pnpm run check-fmt:js + pnpm run check-fmt:clj + pnpm run check-fmt:scss + pnpm run lint:clj + pnpm run lint:js + pnpm run lint:scss + + - name: Unit Tests + working-directory: ./frontend + run: | + ./scripts/test + + - name: Component Tests + working-directory: ./frontend + env: + VITEST_BROWSER_TIMEOUT: 120000 + run: | + ./scripts/test-components diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml new file mode 100644 index 0000000000..46b6b82649 --- /dev/null +++ b/.github/workflows/tests-integration.yml @@ -0,0 +1,93 @@ +name: "CI: Integration" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'frotend/**' + - 'common/**' + - 'render-wasm/**' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'frotend/**' + - 'common/**' + - 'render-wasm/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-integration: + if: ${{ !github.event.pull_request.draft }} + name: "Build Integration Bundle" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Build Bundle + working-directory: ./frontend + run: | + ./scripts/build + + - name: Store Bundle Cache + uses: actions/cache@v5 + with: + key: "integration-bundle-${{ github.sha }}" + path: frontend/resources/public + + test-integration: + if: ${{ !github.event.pull_request.draft }} + name: "Integration Tests" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + needs: build-integration + + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + + - name: Restore Cache + uses: actions/cache/restore@v5 + with: + key: "integration-bundle-${{ github.sha }}" + path: frontend/resources/public + + - name: Run Tests + working-directory: ./frontend + run: | + ./scripts/test-e2e + + - name: Upload test result + uses: actions/upload-artifact@v7 + if: always() + with: + name: integration-tests-result + path: frontend/test-results/ + overwrite: true + retention-days: 3 diff --git a/.github/workflows/tests-library.yml b/.github/workflows/tests-library.yml new file mode 100644 index 0000000000..4c84965f4c --- /dev/null +++ b/.github/workflows/tests-library.yml @@ -0,0 +1,58 @@ +name: "CI: Library" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'common/**' + - 'library/**' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'common/**' + - 'library/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-library: + if: ${{ !github.event.pull_request.draft }} + name: "Library Tests" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Lint + working-directory: ./library + run: | + corepack enable; + corepack install; + pnpm install; + pnpm run check-fmt + pnpm run lint + + - name: Tests + working-directory: ./library + run: | + ./scripts/test diff --git a/.github/workflows/tests-plugins.yml b/.github/workflows/tests-plugins.yml new file mode 100644 index 0000000000..5cc161461c --- /dev/null +++ b/.github/workflows/tests-plugins.yml @@ -0,0 +1,83 @@ +name: "CI: Plugins" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'plugins/**' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'plugins/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-plugins: + if: ${{ !github.event.pull_request.draft }} + name: Plugins Runtime Linter & Tests + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + steps: + - uses: actions/checkout@v6 + + - name: Setup Node + id: setup-node + uses: actions/setup-node@v6 + with: + node-version-file: .nvmrc + + - name: Install deps + working-directory: ./plugins + shell: bash + run: | + corepack enable; + corepack install; + pnpm install; + + - name: Run Lint + working-directory: ./plugins + run: pnpm run lint + + - name: Run Format Check + working-directory: ./plugins + run: pnpm run format:check + + - name: Run Test + working-directory: ./plugins + run: pnpm run test + + - name: Build runtime + working-directory: ./plugins + run: pnpm run build:runtime + + - name: Build doc + working-directory: ./plugins + run: pnpm run build:doc + + - name: Build plugins + working-directory: ./plugins + run: pnpm run build:plugins + + - name: Build styles + working-directory: ./plugins + run: pnpm run build:styles-example diff --git a/.github/workflows/tests-wasm.yml b/.github/workflows/tests-wasm.yml new file mode 100644 index 0000000000..424d4f908f --- /dev/null +++ b/.github/workflows/tests-wasm.yml @@ -0,0 +1,57 @@ +name: "CI: WASM" + +defaults: + run: + shell: bash + +on: + pull_request: + paths: + - 'render-wasm/**' + + types: + - opened + - synchronize + - ready_for_review + + push: + branches: + - develop + - staging + + paths: + - 'render-wasm/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-render-wasm: + if: ${{ !github.event.pull_request.draft }} + name: "Render WASM Tests" + runs-on: penpot-runner-02 + container: + image: penpotapp/devenv:latest + volumes: + - /var/cache/github-runner/m2:/root/.m2 + - /var/cache/github-runner/gitlib:/root/.gitlibs + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Format + working-directory: ./render-wasm + run: | + cargo fmt --check + + - name: Lint + working-directory: ./render-wasm + run: | + ./lint + + - name: Test + working-directory: ./render-wasm + run: | + ./test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 4bbe6ddd3b..0000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,411 +0,0 @@ -name: "CI" - -defaults: - run: - shell: bash - -on: - pull_request: - types: - - opened - - synchronize - - ready_for_review - push: - branches: - - develop - - staging - -concurrency: - group: ${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - lint: - if: ${{ !github.event.pull_request.draft }} - name: "Linter" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Lint Common - working-directory: ./common - run: | - corepack enable; - corepack install; - pnpm install; - pnpm run check-fmt:clj - pnpm run check-fmt:js - pnpm run lint:clj - - - name: Lint Frontend - working-directory: ./frontend - run: | - corepack enable; - corepack install; - pnpm install; - pnpm run check-fmt:js - pnpm run check-fmt:clj - pnpm run check-fmt:scss - pnpm run lint:clj - pnpm run lint:js - pnpm run lint:scss - - - name: Lint Backend - working-directory: ./backend - run: | - corepack enable; - corepack install; - pnpm install; - pnpm run check-fmt - pnpm run lint - - - name: Lint Exporter - working-directory: ./exporter - run: | - corepack enable; - corepack install; - pnpm install; - pnpm run check-fmt - pnpm run lint - - - name: Lint Library - working-directory: ./library - run: | - corepack enable; - corepack install; - pnpm install; - pnpm run check-fmt - pnpm run lint - - test-common: - if: ${{ !github.event.pull_request.draft }} - name: "Common Tests" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Run tests - working-directory: ./common - run: | - ./scripts/test - - test-plugins: - if: ${{ !github.event.pull_request.draft }} - name: Plugins Runtime Linter & Tests - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - uses: actions/checkout@v6 - - - name: Setup Node - id: setup-node - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: Install deps - working-directory: ./plugins - shell: bash - run: | - corepack enable; - corepack install; - pnpm install; - - - name: Run Lint - working-directory: ./plugins - run: pnpm run lint - - - name: Run Format Check - working-directory: ./plugins - run: pnpm run format:check - - - name: Run Test - working-directory: ./plugins - run: pnpm run test - - - name: Build runtime - working-directory: ./plugins - run: pnpm run build:runtime - - - name: Build doc - working-directory: ./plugins - run: pnpm run build:doc - - - name: Build plugins - working-directory: ./plugins - run: pnpm run build:plugins - - - name: Build styles - working-directory: ./plugins - run: pnpm run build:styles-example - - test-frontend: - if: ${{ !github.event.pull_request.draft }} - name: "Frontend Tests" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Unit Tests - working-directory: ./frontend - run: | - ./scripts/test - - - name: Component Tests - working-directory: ./frontend - env: - VITEST_BROWSER_TIMEOUT: 120000 - run: | - ./scripts/test-components - - test-render-wasm: - if: ${{ !github.event.pull_request.draft }} - name: "Render WASM Tests" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Format - working-directory: ./render-wasm - run: | - cargo fmt --check - - - name: Lint - working-directory: ./render-wasm - run: | - ./lint - - - name: Test - working-directory: ./render-wasm - run: | - ./test - - test-backend: - if: ${{ !github.event.pull_request.draft }} - name: "Backend Tests" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - services: - postgres: - image: postgres:17 - # Provide the password for postgres - env: - POSTGRES_USER: penpot_test - POSTGRES_PASSWORD: penpot_test - POSTGRES_DB: penpot_test - - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - redis: - image: valkey/valkey:9 - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Run tests - working-directory: ./backend - env: - PENPOT_TEST_DATABASE_URI: "postgresql://postgres/penpot_test" - PENPOT_TEST_DATABASE_USERNAME: penpot_test - PENPOT_TEST_DATABASE_PASSWORD: penpot_test - PENPOT_TEST_REDIS_URI: "redis://redis/1" - - run: | - mkdir -p /tmp/penpot; - clojure -M:dev:test --reporter kaocha.report/documentation - - test-library: - if: ${{ !github.event.pull_request.draft }} - name: "Library Tests" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Run tests - working-directory: ./library - run: | - ./scripts/test - - build-integration: - if: ${{ !github.event.pull_request.draft }} - name: "Build Integration Bundle" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Build Bundle - working-directory: ./frontend - run: | - ./scripts/build - - - name: Store Bundle Cache - uses: actions/cache@v5 - with: - key: "integration-bundle-${{ github.sha }}" - path: frontend/resources/public - - test-integration-1: - if: ${{ !github.event.pull_request.draft }} - name: "Integration Tests 1/3" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - needs: build-integration - - steps: - - name: Checkout Repository - uses: actions/checkout@v6 - - - name: Restore Cache - uses: actions/cache/restore@v5 - with: - key: "integration-bundle-${{ github.sha }}" - path: frontend/resources/public - - - name: Run Tests - working-directory: ./frontend - run: | - ./scripts/test-e2e --shard="1/3"; - - - name: Upload test result - uses: actions/upload-artifact@v7 - if: always() - with: - name: integration-tests-result-1 - path: frontend/test-results/ - overwrite: true - retention-days: 3 - - test-integration-2: - if: ${{ !github.event.pull_request.draft }} - name: "Integration Tests 2/3" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - needs: build-integration - - steps: - - name: Checkout Repository - uses: actions/checkout@v6 - - - name: Restore Cache - uses: actions/cache/restore@v5 - with: - key: "integration-bundle-${{ github.sha }}" - path: frontend/resources/public - - - name: Run Tests - working-directory: ./frontend - run: | - ./scripts/test-e2e --shard="2/3"; - - - name: Upload test result - uses: actions/upload-artifact@v7 - if: always() - with: - name: integration-tests-result-2 - path: frontend/test-results/ - overwrite: true - retention-days: 3 - - test-integration-3: - if: ${{ !github.event.pull_request.draft }} - name: "Integration Tests 3/3" - runs-on: penpot-runner-02 - container: - image: penpotapp/devenv:latest - volumes: - - /var/cache/github-runner/m2:/root/.m2 - - /var/cache/github-runner/gitlib:/root/.gitlibs - - needs: build-integration - - steps: - - name: Checkout Repository - uses: actions/checkout@v6 - - - name: Restore Cache - uses: actions/cache/restore@v5 - with: - key: "integration-bundle-${{ github.sha }}" - path: frontend/resources/public - - - name: Run Tests - working-directory: ./frontend - run: | - ./scripts/test-e2e --shard="3/3"; - - - name: Upload test result - uses: actions/upload-artifact@v7 - if: always() - with: - name: integration-tests-result-3 - path: frontend/test-results/ - overwrite: true - retention-days: 3