♻️ Replace CircleCI with Github Actions (#7789)

* ♻️ Replace circleci with github actions

* 📎 Add integration test sharding

* 📎 Reuse single build for integration tests shards
This commit is contained in:
Andrey Antukh 2025-11-24 10:44:04 +01:00 committed by GitHub
parent 00a45cb274
commit 553b73a83c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 245 additions and 408 deletions

View File

@ -1,305 +0,0 @@
version: 2.1
jobs:
lint:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
steps:
- checkout
- run:
name: "fmt check"
working_directory: "."
command: |
yarn install
yarn run fmt:clj:check
- run:
name: "lint clj common"
working_directory: "."
command: |
yarn run lint:clj:common
- run:
name: "lint clj frontend"
working_directory: "."
command: |
yarn run lint:clj:frontend
- run:
name: "lint clj backend"
working_directory: "."
command: |
yarn run lint:clj:backend
- run:
name: "lint clj exporter"
working_directory: "."
command: |
yarn run lint:clj:exporter
- run:
name: "lint clj library"
working_directory: "."
command: |
yarn run lint:clj:library
test-common:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx4g -Xms100m -XX:+UseSerialGC
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "common/deps.edn"}}-{{ checksum "common/yarn.lock" }}
- run:
name: "JVM tests"
working_directory: "./common"
command: |
clojure -M:dev:test
- run:
name: "NODE tests"
working_directory: "./common"
command: |
yarn install
yarn run test
- save_cache:
paths:
- ~/.m2
- ~/.yarn
- ~/.gitlibs
- ~/.cache/ms-playwright
key: v1-dependencies-{{ checksum "common/deps.edn"}}-{{ checksum "common/yarn.lock" }}
test-frontend:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx4g -Xms100m -XX:+UseSerialGC
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }}
- run:
name: "install dependencies"
working_directory: "./frontend"
# We install playwright here because the dependent tasks
# uses the same cache as this task so we prepopulate it
command: |
yarn install
yarn run playwright install chromium --with-deps
- run:
name: "lint scss on frontend"
working_directory: "./frontend"
command: |
yarn run lint:scss
- run:
name: "unit tests"
working_directory: "./frontend"
command: |
yarn run test
- save_cache:
paths:
- ~/.m2
- ~/.yarn
- ~/.gitlibs
- ~/.cache/ms-playwright
key: v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }}
test-library:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx6g
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }}
- run:
name: Install dependencies and build
working_directory: "./library"
command: |
yarn install
- run:
name: Build and Test
working_directory: "./library"
command: |
./scripts/build
yarn run test
test-components:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx6g -Xms2g
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }}
- run:
name: Install dependencies
working_directory: "./frontend"
command: |
yarn install
yarn run playwright install chromium
- run:
name: Build Storybook
working_directory: "./frontend"
command: yarn run build:storybook
- run:
name: Serve Storybook and run tests
working_directory: "./frontend"
command: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn test:storybook"
test-backend:
docker:
- image: penpotapp/devenv:latest
- image: cimg/postgres:14.5
environment:
POSTGRES_USER: penpot_test
POSTGRES_PASSWORD: penpot_test
POSTGRES_DB: penpot_test
- image: cimg/redis:7.0.5
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx4g -Xms100m -XX:+UseSerialGC
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "backend/deps.edn" }}
- run:
name: "tests"
working_directory: "./backend"
command: |
clojure -M:dev:test --reporter kaocha.report/documentation
environment:
PENPOT_TEST_DATABASE_URI: "postgresql://localhost/penpot_test"
PENPOT_TEST_DATABASE_USERNAME: penpot_test
PENPOT_TEST_DATABASE_PASSWORD: penpot_test
PENPOT_TEST_REDIS_URI: "redis://localhost/1"
- save_cache:
paths:
- ~/.m2
- ~/.gitlibs
key: v1-dependencies-{{ checksum "backend/deps.edn" }}
test-render-wasm:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
steps:
- checkout
- run:
name: "fmt check"
working_directory: "./render-wasm"
command: |
cargo fmt --check
- run:
name: "lint"
working_directory: "./render-wasm"
command: |
./lint
- run:
name: "cargo tests"
working_directory: "./render-wasm"
command: |
./test
workflows:
penpot:
jobs:
- test-frontend:
requires:
- lint: success
- test-library:
requires:
- lint: success
- test-components:
requires:
- lint: success
- test-backend:
requires:
- lint: success
- test-common:
requires:
- lint: success
- lint
- test-render-wasm

View File

@ -1,4 +1,4 @@
name: "CI: Tests" name: "CI"
defaults: defaults:
run: run:
@ -16,125 +16,140 @@ on:
- develop - develop
- staging - staging
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
# lint: lint:
# name: "Code Linter" name: "Code Linter"
# runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
# container: penpotapp/devenv:latest container: penpotapp/devenv:latest
# steps: steps:
# - name: Checkout repository - name: Checkout repository
# uses: actions/checkout@v4 uses: actions/checkout@v4
# - name: Check clojure code format - name: Check clojure code format
# run: | run: |
# corepack enable; corepack enable;
# corepack install; corepack install;
# yarn install yarn install
# yarn run fmt:clj:check yarn run fmt:clj:check
# test-common: test-common:
# name: "Common Tests" name: "Common Tests"
# runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
# container: penpotapp/devenv:latest container: penpotapp/devenv:latest
# steps: steps:
# - name: Checkout repository - name: Checkout repository
# uses: actions/checkout@v4 uses: actions/checkout@v4
# - name: Run tests on JVM - name: Run tests on JVM
# working-directory: ./common working-directory: ./common
# run: | run: |
# clojure -M:dev:test clojure -M:dev:test
# - name: Run tests on NODE - name: Run tests on NODE
# working-directory: ./common working-directory: ./common
# run: | run: |
# corepack enable; corepack enable;
# corepack install; corepack install;
# yarn install; yarn install;
# yarn run test; yarn run test;
# test-frontend: test-frontend:
# name: "Frontend Tests" name: "Frontend Tests"
# runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
# container: penpotapp/devenv:latest container: penpotapp/devenv:latest
# steps: steps:
# - name: Checkout repository - name: Checkout repository
# uses: actions/checkout@v4 uses: actions/checkout@v4
# - name: Unit Tests - name: Unit Tests
# working-directory: ./frontend working-directory: ./frontend
# run: | run: |
# corepack enable; corepack enable;
# corepack install; corepack install;
# yarn install; yarn install;
# yarn run test; yarn run test;
# - name: Component Tests - name: Component Tests
# working-directory: ./frontend working-directory: ./frontend
# run: | run: |
# yarn run playwright install chromium --with-deps; yarn run playwright install chromium --with-deps;
# yarn run build:storybook yarn run build:storybook
# npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
# "npx http-server storybook-static --port 6006 --silent" \ "npx http-server storybook-static --port 6006 --silent" \
# "npx wait-on tcp:6006 && yarn test:storybook" "npx wait-on tcp:6006 && yarn test:storybook"
# - name: Check SCSS Format - name: Check SCSS Format
# working-directory: ./frontend working-directory: ./frontend
# run: | run: |
# yarn run lint:scss; yarn run lint:scss;
# test-backend: test-backend:
# name: "Backend Tests" name: "Backend Tests"
# runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
# container: penpotapp/devenv:latest container: penpotapp/devenv:latest
# services: services:
# postgres: postgres:
# image: postgres:17 image: postgres:17
# # Provide the password for postgres # Provide the password for postgres
# env: env:
# POSTGRES_USER: penpot_test POSTGRES_USER: penpot_test
# POSTGRES_PASSWORD: penpot_test POSTGRES_PASSWORD: penpot_test
# POSTGRES_DB: penpot_test POSTGRES_DB: penpot_test
# # Set health checks to wait until postgres has started # Set health checks to wait until postgres has started
# options: >- options: >-
# --health-cmd pg_isready --health-cmd pg_isready
# --health-interval 10s --health-interval 10s
# --health-timeout 5s --health-timeout 5s
# --health-retries 5 --health-retries 5
# redis: redis:
# image: valkey/valkey:9 image: valkey/valkey:9
# steps: steps:
# - name: Checkout repository - name: Checkout repository
# uses: actions/checkout@v4 uses: actions/checkout@v4
# test-library: - name: Run tests
# name: "Library Tests" working-directory: ./backend
# runs-on: ubuntu-24.04 env:
# container: penpotapp/devenv:latest 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"
# steps: run: |
# - name: Checkout repository clojure -M:dev:test --reporter kaocha.report/documentation
# uses: actions/checkout@v4
# - name: Run tests test-library:
# working-directory: ./library name: "Library Tests"
# run: | runs-on: ubuntu-24.04
# corepack enable; container: penpotapp/devenv:latest
# corepack install;
# yarn install;
# yarn run build:bundle;
# yarn run test;
test-integration: steps:
name: "Integration Tests" - name: Checkout repository
uses: actions/checkout@v4
- name: Run tests
working-directory: ./library
run: |
corepack enable;
corepack install;
yarn install;
yarn run build:bundle;
yarn run test;
build-integration:
name: "Build Integration Bundle"
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
container: penpotapp/devenv:latest container: penpotapp/devenv:latest
@ -157,17 +172,144 @@ jobs:
run: | run: |
./build release ./build release
- name: Store Bundle Cache
uses: actions/cache@v4
with:
key: "integration-bundle-${{ github.sha }}"
path: frontend/resources/public
test-integration-1:
name: "Integration Tests 1/4"
runs-on: ubuntu-24.04
container: penpotapp/devenv:latest
needs: build-integration
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v4
with:
key: "integration-bundle-${{ github.sha }}"
path: frontend/resources/public
- name: Run Tests - name: Run Tests
working-directory: ./frontend working-directory: ./frontend
run: | run: |
yarn run playwright install chromium --with-deps corepack enable;
yarn run test:e2e -x --workers=1 --reporter=line corepack install;
yarn install;
yarn run playwright install chromium --with-deps;
yarn run test:e2e -x --workers=2 --reporter=list --shard="1/4";
- name: Upload test result - name: Upload test result
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: integration-tests-result name: integration-tests-result-1
path: frontend/test-results/
overwrite: true
retention-days: 3
test-integration-2:
name: "Integration Tests 2/4"
runs-on: ubuntu-24.04
container: penpotapp/devenv:latest
needs: build-integration
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v4
with:
key: "integration-bundle-${{ github.sha }}"
path: frontend/resources/public
- name: Run Tests
working-directory: ./frontend
run: |
corepack enable;
corepack install;
yarn install;
yarn run playwright install chromium --with-deps;
yarn run test:e2e -x --workers=2 --reporter=list --shard "2/4";
- name: Upload test result
uses: actions/upload-artifact@v4
if: always()
with:
name: integration-tests-result-2
path: frontend/test-results/
overwrite: true
retention-days: 3
test-integration-3:
name: "Integration Tests 3/4"
runs-on: ubuntu-24.04
container: penpotapp/devenv:latest
needs: build-integration
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v4
with:
key: "integration-bundle-${{ github.sha }}"
path: frontend/resources/public
- name: Run Tests
working-directory: ./frontend
run: |
corepack enable;
corepack install;
yarn install;
yarn run playwright install chromium --with-deps;
yarn run test:e2e -x --workers=2 --reporter=list --shard "3/4";
- name: Upload test result
uses: actions/upload-artifact@v4
if: always()
with:
name: integration-tests-result-3
path: frontend/test-results/
overwrite: true
retention-days: 3
test-integration-4:
name: "Integration Tests 3/4"
runs-on: ubuntu-24.04
container: penpotapp/devenv:latest
needs: build-integration
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache/restore@v4
with:
key: "integration-bundle-${{ github.sha }}"
path: frontend/resources/public
- name: Run Tests
working-directory: ./frontend
run: |
corepack enable;
corepack install;
yarn install;
yarn run playwright install chromium --with-deps;
yarn run test:e2e -x --workers=2 --reporter=list --shard "4/4";
- name: Upload test result
uses: actions/upload-artifact@v4
if: always()
with:
name: integration-tests-result-4
path: frontend/test-results/ path: frontend/test-results/
overwrite: true overwrite: true
retention-days: 3 retention-days: 3

View File

@ -22,9 +22,9 @@ export default defineConfig({
workers: 1, workers: 1,
/* Timeout for expects (longer in CI) */ /* Timeout for expects (longer in CI) */
timeout: 60000, timeout: 80000,
expect: { expect: {
timeout: process.env.CI ? 30000 : 5000, timeout: process.env.CI ? 40000 : 5000,
}, },
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */