Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
orencohendev authored Jul 31, 2023
2 parents 36d527d + e97140f commit c8c36a4
Show file tree
Hide file tree
Showing 1,176 changed files with 33,103 additions and 18,990 deletions.
25 changes: 25 additions & 0 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Restore dependency & build cache"
description: "Restore the dependency & build cache."

runs:
using: "composite"
steps:
- name: Check dependency cache
id: dep-cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ env.DEPENDENCY_CACHE_KEY }}

- name: Check build cache
uses: actions/cache/restore@v3
id: build-cache
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ github.sha }}

- name: Check if caches are restored
uses: actions/github-script@v6
if: steps.dep-cache.outputs.cache-hit != 'true' || steps.build-cache.outputs.cache-hit != 'true'
with:
script: core.setFailed('Dependency or build cache could not be restored - please re-run ALL jobs.')
12 changes: 6 additions & 6 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ coverage:
patch: false
project:
default: false
e2e-tests:
admin-tests:
flags:
- e2e-tests
- admin-tests
threshold: 0.2%
unit-tests:
e2e-tests:
flags:
- unit-tests
- e2e-tests
threshold: 0.2%
flags:
e2e-tests:
admin-tests:
carryforward: true
unit-tests:
e2e-tests:
carryforward: true
13 changes: 0 additions & 13 deletions .github/hooks/pre-push

This file was deleted.

117 changes: 70 additions & 47 deletions .github/dev.js → .github/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ if (nodeVersion < 18) {
process.exit(1);
}

const config = require('../ghost/core/core/shared/config/loader').loadNconf({
customConfigPath: path.join(__dirname, '../ghost/core')
const config = require('../../ghost/core/core/shared/config/loader').loadNconf({
customConfigPath: path.join(__dirname, '../../ghost/core')
});

const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
Expand All @@ -25,63 +25,41 @@ let commands = [];
const COMMAND_GHOST = {
name: 'ghost',
// Note: if this isn't working for you, please use Node 18 and above
command: 'node --watch index.js',
cwd: path.resolve(__dirname, '../ghost/core'),
command: 'nx run ghost:dev',
cwd: path.resolve(__dirname, '../../ghost/core'),
prefixColor: 'blue',
env: {}
};

const COMMAND_ADMIN = {
name: 'admin',
command: `yarn start --live-reload-base-url=${liveReloadBaseUrl} --live-reload-port=4201`,
cwd: path.resolve(__dirname, '../ghost/admin'),
cwd: path.resolve(__dirname, '../../ghost/admin'),
prefixColor: 'green',
env: {}
};

const COMMAND_TYPESCRIPT = {
name: 'ts',
command: 'nx watch --projects=ghost/collections,ghost/in-memory-repository,ghost/mail-events,ghost/model-to-domain-event-interceptor,ghost/post-revisions,ghost/nql-filter-expansions -- nx run \\$NX_PROJECT_NAME:build:ts',
cwd: path.resolve(__dirname, '../../'),
prefixColor: 'cyan',
env: {}
};

if (DASH_DASH_ARGS.includes('ghost')) {
commands = [COMMAND_GHOST];
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT];
} else if (DASH_DASH_ARGS.includes('admin')) {
commands = [COMMAND_ADMIN];
} else {
commands = [COMMAND_GHOST, COMMAND_ADMIN];
}

if (DASH_DASH_ARGS.includes('revisions') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'post-revisions',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../ghost/post-revisions'),
prefixColor: 'green',
env: {}
});
}

if (DASH_DASH_ARGS.includes('in-memory-repository') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'in-memory-repository',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../ghost/in-memory-repository'),
prefixColor: 'pink',
env: {}
});
}

if (DASH_DASH_ARGS.includes('collections') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'collections',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../ghost/collections'),
prefixColor: 'pink',
env: {}
});
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT, COMMAND_ADMIN];
}

if (DASH_DASH_ARGS.includes('admin-x') || DASH_DASH_ARGS.includes('adminx') || DASH_DASH_ARGS.includes('adminX') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'adminX',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../ghost/admin-x-settings'),
cwd: path.resolve(__dirname, '../../apps/admin-x-settings'),
prefixColor: '#C35831',
env: {}
});
Expand All @@ -92,18 +70,30 @@ if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'portal',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../apps/portal'),
cwd: path.resolve(__dirname, '../../apps/portal'),
prefixColor: 'magenta',
env: {}
});
COMMAND_GHOST.env['portal__url'] = 'http://localhost:4175/portal.min.js';

if (DASH_DASH_ARGS.includes('https')) {
// Safari needs HTTPS for it to work
// To make this work, you'll need a CADDY server running in front
// Note the port is different because of this extra layer. Use the following Caddyfile:
// https://localhost:4176 {
// reverse_proxy http://localhost:4175
// }

COMMAND_GHOST.env['portal__url'] = 'https://localhost:4176/portal.min.js';
} else {
COMMAND_GHOST.env['portal__url'] = 'http://localhost:4175/portal.min.js';
}
}

if (DASH_DASH_ARGS.includes('signup') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'signup-form',
command: DASH_DASH_ARGS.includes('signup') ? 'yarn dev' : 'yarn preview',
cwd: path.resolve(__dirname, '../ghost/signup-form'),
cwd: path.resolve(__dirname, '../../apps/signup-form'),
prefixColor: 'magenta',
env: {}
});
Expand All @@ -114,27 +104,60 @@ if (DASH_DASH_ARGS.includes('announcement-bar') || DASH_DASH_ARGS.includes('anno
commands.push({
name: 'announcement-bar',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../apps/announcement-bar'),
cwd: path.resolve(__dirname, '../../apps/announcement-bar'),
prefixColor: '#DC9D00',
env: {}
});
COMMAND_GHOST.env['announcementBar__url'] = 'http://localhost:5371/announcement-bar';
COMMAND_GHOST.env['announcementBar__url'] = 'http://localhost:4177/announcement-bar.min.js';
}

if (DASH_DASH_ARGS.includes('search') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'search',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../apps/sodo-search'),
cwd: path.resolve(__dirname, '../../apps/sodo-search'),
prefixColor: '#23de43',
env: {}
});
COMMAND_GHOST.env['sodoSearch__url'] = 'http://localhost:5370/umd/sodo-search.min.js';
COMMAND_GHOST.env['sodoSearch__styles'] = 'http://localhost:5370/umd/main.css';
COMMAND_GHOST.env['sodoSearch__url'] = 'http://localhost:4178/sodo-search.min.js';
COMMAND_GHOST.env['sodoSearch__styles'] = 'http://localhost:4178/main.css';
}

if (DASH_DASH_ARGS.includes('lexical')) {
COMMAND_GHOST.env['editor__url'] = 'http://localhost:4173/koenig-lexical.umd.js';
if (DASH_DASH_ARGS.includes('https')) {
// Safari needs HTTPS for it to work
// To make this work, you'll need a CADDY server running in front
// Note the port is different because of this extra layer. Use the following Caddyfile:
// https://localhost:4174 {
// reverse_proxy http://127.0.0.1:4173
// }

COMMAND_GHOST.env['editor__url'] = 'https://localhost:4174/koenig-lexical.umd.js';
} else {
COMMAND_GHOST.env['editor__url'] = 'http://localhost:4173/koenig-lexical.umd.js';
}
}

if (DASH_DASH_ARGS.includes('comments') || DASH_DASH_ARGS.includes('all')) {
if (DASH_DASH_ARGS.includes('https')) {
// Safari needs HTTPS for it to work
// To make this work, you'll need a CADDY server running in front
// Note the port is different because of this extra layer. Use the following Caddyfile:
// https://localhost:7174 {
// reverse_proxy http://127.0.0.1:7173
// }
COMMAND_GHOST.env['comments__url'] = 'https://localhost:7174/comments-ui.min.js';
} else {
COMMAND_GHOST.env['comments__url'] = 'http://localhost:7173/comments-ui.min.js';
}

commands.push({
name: 'comments',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../../apps/comments-ui'),
prefixColor: '#E55137',
env: {}
});
}

async function handleStripe() {
Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/admin-x-settings-tests.yml

This file was deleted.

21 changes: 18 additions & 3 deletions .github/workflows/browser-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,28 @@ jobs:
- name: Install dependencies
run: yarn

- name: Build packages
run: yarn nx run-many -t build:ts

- name: Run migrations
working-directory: ghost/core
run: yarn setup
run: yarn knex-migrator init

- name: Install Playwright
working-directory: ghost/core
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Check if Playwright browser is cached
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-Playwright-${{steps.playwright-version.outputs.version}}
- name: Install Playwright browser if not cached
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Install OS dependencies of Playwright if cache hit
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps

- name: Build Admin
if: env.ENVIRONMENT == 'browser-tests-local'
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/canary.yml

This file was deleted.

Loading

0 comments on commit c8c36a4

Please sign in to comment.