2021-09-07 21:29:37 -05:00
|
|
|
name: Main
|
2021-07-27 12:13:51 -05:00
|
|
|
|
|
|
|
on:
|
2022-06-22 05:55:58 -05:00
|
|
|
push:
|
2022-07-01 07:33:08 -05:00
|
|
|
branches:
|
|
|
|
- master
|
2023-10-19 21:46:09 -05:00
|
|
|
- "push-action/**"
|
2022-06-27 03:38:39 -05:00
|
|
|
pull_request:
|
2021-07-27 12:13:51 -05:00
|
|
|
|
2022-06-21 21:11:54 -05:00
|
|
|
concurrency:
|
2023-01-18 22:22:17 -05:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
2022-06-17 10:58:29 -05:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-07-27 12:13:51 -05:00
|
|
|
jobs:
|
2022-05-22 03:12:29 -05:00
|
|
|
main-build:
|
2021-07-27 12:13:51 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-05 03:13:24 -05:00
|
|
|
- uses: actions/checkout@v4
|
2021-07-27 12:13:51 -05:00
|
|
|
|
2021-08-20 05:16:00 -05:00
|
|
|
- name: Setup Node and pnpm
|
2024-07-04 01:26:28 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v5
|
2021-07-27 12:13:51 -05:00
|
|
|
|
2021-09-07 21:29:37 -05:00
|
|
|
- name: Build
|
2022-05-17 21:58:01 -05:00
|
|
|
run: pnpm ci:build
|
2021-09-07 21:29:37 -05:00
|
|
|
|
2024-07-28 00:55:55 -05:00
|
|
|
main-check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v5
|
|
|
|
|
|
|
|
- name: Prepack
|
|
|
|
run: pnpm prepack
|
|
|
|
|
|
|
|
- name: Check
|
|
|
|
run: pnpm -r check
|
|
|
|
|
2022-05-22 03:12:29 -05:00
|
|
|
main-lint:
|
2022-12-12 00:43:23 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-22 03:12:29 -05:00
|
|
|
|
|
|
|
steps:
|
2023-09-05 03:13:24 -05:00
|
|
|
- uses: actions/checkout@v4
|
2022-05-22 03:12:29 -05:00
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2024-07-04 01:26:28 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v5
|
2022-05-22 03:12:29 -05:00
|
|
|
|
|
|
|
- name: Prepack
|
|
|
|
run: pnpm prepack
|
|
|
|
|
2021-07-27 12:13:51 -05:00
|
|
|
- name: Lint
|
2022-05-17 21:58:01 -05:00
|
|
|
run: pnpm ci:lint
|
2021-07-27 12:13:51 -05:00
|
|
|
|
2022-05-17 08:20:17 -05:00
|
|
|
- name: Stylelint
|
2022-05-17 21:58:01 -05:00
|
|
|
run: pnpm ci:stylelint
|
2022-02-16 02:04:34 -05:00
|
|
|
|
2022-05-22 03:12:29 -05:00
|
|
|
main-test:
|
2024-05-13 03:24:28 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-22 03:12:29 -05:00
|
|
|
|
|
|
|
steps:
|
2023-09-05 03:13:24 -05:00
|
|
|
- uses: actions/checkout@v4
|
2022-05-22 03:12:29 -05:00
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2024-07-04 01:26:28 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v5
|
2022-05-22 03:12:29 -05:00
|
|
|
|
2022-12-12 08:52:17 -05:00
|
|
|
- name: Build for test
|
|
|
|
run: pnpm -r build:test
|
2022-05-22 03:12:29 -05:00
|
|
|
|
2024-10-22 02:43:27 -05:00
|
|
|
- name: Install playwright for element tests
|
|
|
|
working-directory: ./packages/elements
|
|
|
|
run: pnpm exec playwright install --with-deps
|
|
|
|
|
2021-09-07 21:29:37 -05:00
|
|
|
- name: Test
|
2022-05-17 21:58:01 -05:00
|
|
|
run: pnpm ci:test
|
2022-01-09 21:04:00 -05:00
|
|
|
|
2022-06-21 21:11:54 -05:00
|
|
|
- name: Codecov core
|
2024-01-31 23:04:42 -05:00
|
|
|
uses: codecov/codecov-action@v4
|
2022-02-28 22:05:25 -05:00
|
|
|
with:
|
|
|
|
flags: core
|
|
|
|
directory: ./packages/core
|
2024-04-25 21:52:14 -05:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2022-06-21 21:11:54 -05:00
|
|
|
|
|
|
|
- name: Codecov ui
|
2024-01-31 23:04:42 -05:00
|
|
|
uses: codecov/codecov-action@v4
|
2022-06-21 21:11:54 -05:00
|
|
|
with:
|
|
|
|
flags: ui
|
|
|
|
directory: ./packages/ui
|
2024-04-25 21:52:14 -05:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2022-10-18 22:35:39 -05:00
|
|
|
|
|
|
|
main-dockerize:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-09-05 03:13:24 -05:00
|
|
|
- uses: actions/checkout@v4
|
2022-10-18 22:35:39 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-09-12 04:23:34 -05:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-10-18 22:35:39 -05:00
|
|
|
|
|
|
|
- name: Build
|
2024-06-18 03:35:11 -05:00
|
|
|
uses: docker/build-push-action@v6
|
2022-10-18 22:35:39 -05:00
|
|
|
with:
|
|
|
|
context: .
|
2023-03-15 04:58:07 -05:00
|
|
|
build-args: | # Test cloud build
|
|
|
|
additional_connector_args=--cloud
|
2023-02-20 21:44:35 -05:00
|
|
|
|
2023-01-17 04:52:54 -05:00
|
|
|
main-alteration:
|
2022-12-29 21:50:56 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-01-17 04:52:54 -05:00
|
|
|
# ** Checkout fresh and alteration ref **
|
2023-09-05 03:13:24 -05:00
|
|
|
- uses: actions/checkout@v4
|
2022-12-29 21:50:56 -05:00
|
|
|
with:
|
2023-01-18 00:23:24 -05:00
|
|
|
fetch-depth: 0
|
2023-01-17 04:52:54 -05:00
|
|
|
path: ./fresh
|
|
|
|
|
2023-01-18 00:23:24 -05:00
|
|
|
# Fetch the current version by finding the latest tag starts with "v", e.g. "v1.0.0-beta.19"
|
|
|
|
- id: version
|
|
|
|
working-directory: ./fresh
|
2023-10-19 21:46:09 -05:00
|
|
|
run: echo "current=$(git describe --match "@logto/core@*" --abbrev=0)" >> $GITHUB_OUTPUT
|
2023-01-18 00:23:24 -05:00
|
|
|
|
2023-09-05 03:13:24 -05:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-17 04:52:54 -05:00
|
|
|
with:
|
2023-01-18 00:23:24 -05:00
|
|
|
ref: ${{ steps.version.outputs.current }}
|
2023-01-17 04:52:54 -05:00
|
|
|
path: ./alteration
|
|
|
|
# ** End **
|
|
|
|
|
|
|
|
- name: Copy lockfile # Make setup workflow happy
|
|
|
|
run: cp ./fresh/pnpm-lock.yaml ./
|
2022-12-29 21:50:56 -05:00
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2024-07-04 01:26:28 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v5
|
2023-01-17 04:52:54 -05:00
|
|
|
with:
|
|
|
|
run-install: false
|
|
|
|
|
|
|
|
# ** Prepack packages **
|
|
|
|
- name: Prepack fresh
|
|
|
|
working-directory: ./fresh
|
|
|
|
run: pnpm i && pnpm prepack
|
|
|
|
|
|
|
|
- name: Prepack alteration
|
|
|
|
working-directory: ./alteration
|
2024-05-14 23:39:56 -05:00
|
|
|
run: pnpm i && pnpm prepack
|
2023-01-17 04:52:54 -05:00
|
|
|
# ** End **
|
2022-12-29 21:50:56 -05:00
|
|
|
|
2023-01-17 04:52:54 -05:00
|
|
|
- name: Setup Postgres
|
2024-06-21 04:02:16 -05:00
|
|
|
uses: ikalnytskyi/action-setup-postgres@v6
|
2023-01-17 04:52:54 -05:00
|
|
|
|
|
|
|
# ** Setup up-to-date databases and compare (test `up`) **
|
|
|
|
- name: Setup fresh database
|
|
|
|
working-directory: ./fresh
|
2023-12-14 04:25:17 -05:00
|
|
|
run: pnpm cli db seed --test
|
2023-01-17 04:52:54 -05:00
|
|
|
env:
|
|
|
|
DB_URL: postgres://postgres:postgres@localhost:5432/fresh
|
|
|
|
|
|
|
|
- name: Setup alteration database
|
|
|
|
working-directory: ./alteration
|
|
|
|
run: |
|
|
|
|
cd packages/cli
|
2024-02-08 11:19:09 -05:00
|
|
|
pnpm start db seed --test
|
2023-01-17 04:52:54 -05:00
|
|
|
env:
|
|
|
|
DB_URL: postgres://postgres:postgres@localhost:5432/alteration
|
|
|
|
|
|
|
|
- name: Run alteration scripts
|
|
|
|
working-directory: ./fresh
|
|
|
|
run: pnpm cli db alt deploy next
|
|
|
|
env:
|
2023-09-13 21:32:46 -05:00
|
|
|
ALTERATION_TEST: true
|
2023-01-17 04:52:54 -05:00
|
|
|
DB_URL: postgres://postgres:postgres@localhost:5432/alteration
|
|
|
|
|
2023-02-02 05:36:18 -05:00
|
|
|
- name: Compare databases
|
2023-01-17 04:52:54 -05:00
|
|
|
working-directory: ./fresh
|
|
|
|
run: node .scripts/compare-database.js fresh alteration
|
|
|
|
# ** End **
|
|
|
|
|
|
|
|
# ** Setup old databases and compare (test `down`) **
|
2023-01-18 00:12:57 -05:00
|
|
|
- name: Setup old database
|
|
|
|
working-directory: ./alteration
|
|
|
|
run: |
|
|
|
|
cd packages/cli
|
2024-02-08 11:19:09 -05:00
|
|
|
pnpm start db seed --test
|
2023-01-18 00:12:57 -05:00
|
|
|
env:
|
|
|
|
DB_URL: postgres://postgres:postgres@localhost:5432/old
|
|
|
|
|
|
|
|
- name: Revert fresh database to old
|
|
|
|
working-directory: ./fresh
|
2023-02-25 10:15:42 -05:00
|
|
|
run: pnpm cli db alt r v$(echo ${{ steps.version.outputs.current }} | cut -d@ -f3)
|
2023-01-18 00:12:57 -05:00
|
|
|
env:
|
2023-09-13 21:32:46 -05:00
|
|
|
ALTERATION_TEST: true
|
2023-01-18 00:12:57 -05:00
|
|
|
DB_URL: postgres://postgres:postgres@localhost:5432/fresh
|
|
|
|
|
|
|
|
- name: Compare manifests
|
|
|
|
working-directory: ./fresh
|
|
|
|
run: node .scripts/compare-database.js fresh old
|
2023-01-17 04:52:54 -05:00
|
|
|
# ** End **
|
2023-01-18 00:12:57 -05:00
|
|
|
|
2024-01-11 01:38:37 -05:00
|
|
|
- name: Check alteration sequence
|
2023-01-18 00:12:57 -05:00
|
|
|
working-directory: ./fresh
|
|
|
|
run: node .scripts/check-alterations-sequence.js
|