name: CI
on:
pull_request:
permissions:
actions: read
contents: read
jobs:
main:
runs-on: ubuntu-latest
if: github.repository == 'activepieces/activepieces'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- name: Turbo Cache
uses: rharkor/caching-for-turbo@v2.2.1
with:
provider: s3
s3-bucket: ${{ secrets.TURBO_CACHE_S3_BUCKET }}
s3-region: auto
s3-endpoint: ${{ secrets.TURBO_CACHE_S3_ENDPOINT }}
s3-access-key-id: ${{ secrets.TURBO_CACHE_S3_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.TURBO_CACHE_S3_SECRET_ACCESS_KEY }}
max-age: 3w
max-size: 20gb
- name: Get changed files
id: changed-files
run: echo "files=$(git diff --name-only HEAD origin/main | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Check if framework or common pieces are changed
id: check-framework-common
run: |
CHANGED_FILES="${{ steps.changed-files.outputs.files }}"
if echo "$CHANGED_FILES" | grep -q "community/framework\|community/common"; then
echo "framework_or_common_changed=true" >> $GITHUB_OUTPUT
else
echo "framework_or_common_changed=false" >> $GITHUB_OUTPUT
fi
- name: Extract pieces package names from changed files
id: extract-pieces
run: |
PIECES=$(echo "${{ steps.changed-files.outputs.files }}" | grep -o "packages/pieces/community/[^/]*" | awk -F'/' '{print $4}' | sort -u | tr '\n' ',' | sed 's/,$//')
if [ -n "$PIECES" ]; then
FILTERS=$(echo "$PIECES" | tr ',' '\n' | sed 's/.*/{&}/' | tr '\n' ',' | sed 's/,$//')
echo "pieces_filters=$FILTERS" >> $GITHUB_OUTPUT
else
echo "pieces_filters=" >> $GITHUB_OUTPUT
fi
- name: Lint core projects
run: npx turbo run lint --filter=@activepieces/shared --filter=@activepieces/engine --filter=server-api --filter=react-ui --filter=@activepieces/server-shared --filter=server-worker --filter=@activepieces/ee-shared --filter=ee-embed-sdk
- name: Lint changed pieces projects
if: steps.extract-pieces.outputs.pieces_filters != '' && steps.check-framework-common.outputs.framework_or_common_changed == 'false'
run: |
IFS=',' read -ra PIECES <<< "${{ steps.extract-pieces.outputs.pieces_filters }}"
FILTER_ARGS=""
for piece in "${PIECES[@]}"; do
FILTER_ARGS="$FILTER_ARGS --filter=./packages/pieces/community/${piece}"
done
npx turbo run lint $FILTER_ARGS
- name: Lint all pieces projects
if: steps.check-framework-common.outputs.framework_or_common_changed == 'true'
run: npx turbo run lint --filter='./packages/pieces/community/*'
- name: Build core projects
run: npx turbo run build --filter=react-ui --filter=server-api --filter=@activepieces/engine
- name: Build changed pieces projects
if: steps.extract-pieces.outputs.pieces_filters != '' && steps.check-framework-common.outputs.framework_or_common_changed == 'false'
run: |
IFS=',' read -ra PIECES <<< "${{ steps.extract-pieces.outputs.pieces_filters }}"
FILTER_ARGS=""
for piece in "${PIECES[@]}"; do
FILTER_ARGS="$FILTER_ARGS --filter=./packages/pieces/community/${piece}"
done
npx turbo run build $FILTER_ARGS
- name: Build all pieces projects
if: steps.check-framework-common.outputs.framework_or_common_changed == 'true'
run: npx turbo run build --filter='./packages/pieces/community/*'
- name: Run all tests and migration check in parallel
run: |
set -euo pipefail
pids=()
npx turbo run test --filter=@activepieces/engine --filter=@activepieces/shared &
pids+=($!)
npx turbo run test-ce --filter=server-api &
pids+=($!)
npx turbo run test-ee --filter=server-api &
pids+=($!)
npx turbo run test-cloud --filter=server-api &
pids+=($!)
npx turbo run check-migrations --filter=server-api &
pids+=($!)
status=0
for pid in "${pids[@]}"; do
if ! wait "$pid"; then
status=1
fi
done
exit $status