0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/.github/workflows/main.yml

204 lines
5 KiB
YAML
Raw Normal View History

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