mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
chore(ci): Parallelize jobs and remove serial setup gate (#12265)
Drop the dedicated setup job that blocked every other job for ~60s, extract the install steps into a reusable composite action, drop the unnecessary bundle-size dependency on types, and switch test-server sharding to Jest's native --shard flag.
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
name: Install
|
||||||
|
description: Set up Node.js, Corepack, and install dependencies with yarn cache
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Enable Corepack
|
||||||
|
shell: bash
|
||||||
|
run: corepack enable
|
||||||
|
- name: Use Node.js 24.x
|
||||||
|
uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: 24.x
|
||||||
|
cache: "yarn"
|
||||||
|
- name: Install dependencies
|
||||||
|
shell: bash
|
||||||
|
run: yarn install --immutable
|
||||||
+30
-115
@@ -18,82 +18,6 @@ env:
|
|||||||
SMTP_USERNAME: localhost
|
SMTP_USERNAME: localhost
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Enable Corepack
|
|
||||||
run: corepack enable
|
|
||||||
- name: Use Node.js 24.x
|
|
||||||
uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Cache node_modules
|
|
||||||
id: cache-node-modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- name: Install dependencies
|
|
||||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
||||||
run: yarn install --immutable
|
|
||||||
|
|
||||||
lint:
|
|
||||||
needs: setup
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Enable Corepack
|
|
||||||
run: corepack enable
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Restore node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- run: yarn lint --quiet
|
|
||||||
|
|
||||||
types:
|
|
||||||
needs: setup
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Enable Corepack
|
|
||||||
run: corepack enable
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Restore node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- run: yarn tsc
|
|
||||||
|
|
||||||
audit:
|
|
||||||
needs: [setup, changes]
|
|
||||||
if: ${{ needs.changes.outputs.deps == 'true' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
- name: Enable Corepack
|
|
||||||
run: corepack enable
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Restore node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- run: yarn npm audit --severity high --recursive --environment production
|
|
||||||
|
|
||||||
changes:
|
changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
@@ -125,8 +49,31 @@ jobs:
|
|||||||
- 'yarn.lock'
|
- 'yarn.lock'
|
||||||
- '.yarnrc.yml'
|
- '.yarnrc.yml'
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: ./.github/actions/install
|
||||||
|
- run: yarn lint --quiet
|
||||||
|
|
||||||
|
types:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: ./.github/actions/install
|
||||||
|
- run: yarn tsc
|
||||||
|
|
||||||
|
audit:
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.deps == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: ./.github/actions/install
|
||||||
|
- run: yarn npm audit --severity high --recursive --environment production
|
||||||
|
|
||||||
test:
|
test:
|
||||||
needs: [setup, changes]
|
needs: changes
|
||||||
if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.config == 'true' }}
|
if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.config == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@@ -134,21 +81,11 @@ jobs:
|
|||||||
test-group: [app, shared]
|
test-group: [app, shared]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Enable Corepack
|
- uses: ./.github/actions/install
|
||||||
run: corepack enable
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Restore node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- run: yarn test:${{ matrix.test-group }}
|
- run: yarn test:${{ matrix.test-group }}
|
||||||
|
|
||||||
test-server:
|
test-server:
|
||||||
needs: [setup, changes]
|
needs: changes
|
||||||
if: ${{ needs.changes.outputs.server == 'true' || needs.changes.outputs.config == 'true' }}
|
if: ${{ needs.changes.outputs.server == 'true' || needs.changes.outputs.config == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
@@ -172,40 +109,18 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Enable Corepack
|
- uses: ./.github/actions/install
|
||||||
run: corepack enable
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Restore node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- run: yarn sequelize db:migrate
|
- run: yarn sequelize db:migrate
|
||||||
- name: Run server tests
|
- name: Run server tests
|
||||||
run: |
|
run: yarn test:server --maxWorkers=2 --shard=${{ matrix.shard }}/4
|
||||||
TESTFILES=$(find . -name "*.test.ts" -path "*/server/*" | sort | awk "NR % 4 == (${{ matrix.shard }} - 1)")
|
|
||||||
yarn test --maxWorkers=2 $TESTFILES
|
|
||||||
|
|
||||||
bundle-size:
|
bundle-size:
|
||||||
needs: [setup, types, changes]
|
needs: changes
|
||||||
if: ${{ (needs.changes.outputs.app == 'true' || needs.changes.outputs.config == 'true') && github.repository == 'outline/outline' }}
|
if: ${{ (needs.changes.outputs.app == 'true' || needs.changes.outputs.config == 'true') && github.repository == 'outline/outline' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Enable Corepack
|
- uses: ./.github/actions/install
|
||||||
run: corepack enable
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 24.x
|
|
||||||
cache: "yarn"
|
|
||||||
- name: Restore node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-modules-24.x-${{ hashFiles('yarn.lock') }}
|
|
||||||
- name: Set environment to production
|
- name: Set environment to production
|
||||||
run: echo "NODE_ENV=production" >> $GITHUB_ENV
|
run: echo "NODE_ENV=production" >> $GITHUB_ENV
|
||||||
- run: yarn vite:build
|
- run: yarn vite:build
|
||||||
|
|||||||
Reference in New Issue
Block a user