2021-09-11 09:51:51 +03:00
|
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
2023-06-09 13:36:55 +03:00
|
|
|
concurrency:
|
2022-06-03 19:44:11 +03:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
# Controls when the action will run.
|
2021-09-11 09:51:51 +03:00
|
|
|
on:
|
|
|
|
# Triggers the workflow on push or pull request events but only for the main branch
|
|
|
|
push:
|
2023-06-20 08:47:00 +03:00
|
|
|
branches: [main]
|
2022-02-23 19:10:43 +03:00
|
|
|
tags:
|
|
|
|
- v*
|
2023-01-06 10:31:30 +03:00
|
|
|
pull_request:
|
2023-06-20 08:47:00 +03:00
|
|
|
branches: [main]
|
2021-09-11 09:51:51 +03:00
|
|
|
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
|
|
jobs:
|
|
|
|
# This workflow contains a single job called "build"
|
|
|
|
build:
|
|
|
|
# The type of runner that the job will run on
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-03 19:44:11 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Cache node modules
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
2023-06-22 11:22:37 +03:00
|
|
|
path: |
|
|
|
|
./common/temp
|
|
|
|
!./common/temp/build-cache
|
2023-07-06 08:55:22 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2022-01-25 11:25:20 +03:00
|
|
|
restore-keys: |
|
2023-07-06 08:55:22 +03:00
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2023-06-22 11:22:37 +03:00
|
|
|
- name: Cache Build cache
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-06-02 20:00:00 +03:00
|
|
|
with:
|
2023-06-22 11:22:37 +03:00
|
|
|
path: ./common/temp/build-cache
|
2023-07-06 08:55:22 +03:00
|
|
|
key: build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2022-06-03 19:44:11 +03:00
|
|
|
restore-keys: |
|
2023-07-06 08:55:22 +03:00
|
|
|
build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2022-06-02 20:00:00 +03:00
|
|
|
|
|
|
|
- name: Checking for mis-matching dependencies...
|
|
|
|
run: node common/scripts/install-run-rush.js check
|
|
|
|
|
|
|
|
- name: Installing...
|
|
|
|
run: node common/scripts/install-run-rush.js install
|
|
|
|
|
|
|
|
- name: Setting model version from git release...
|
|
|
|
run: node common/scripts/install-run-rush.js bump-model-version
|
|
|
|
|
|
|
|
- name: Building...
|
2022-06-03 19:44:11 +03:00
|
|
|
run: node common/scripts/install-run-rush.js build
|
2022-01-25 11:25:20 +03:00
|
|
|
|
2023-06-09 13:36:55 +03:00
|
|
|
- name: Bundle
|
|
|
|
run: node common/scripts/install-run-rush.js bundle --verbose
|
|
|
|
|
2022-06-03 19:44:11 +03:00
|
|
|
- name: Cache build results for next jobs
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
2022-04-01 08:57:22 +03:00
|
|
|
products
|
2022-01-25 11:25:20 +03:00
|
|
|
server
|
2022-02-22 12:09:13 +03:00
|
|
|
server-plugins
|
2022-01-25 11:25:20 +03:00
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
2022-11-15 05:51:46 +03:00
|
|
|
tools
|
2022-06-03 19:44:11 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
svelte-check:
|
2022-04-29 19:47:22 +03:00
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-04-29 19:47:22 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Cache build results
|
|
|
|
uses: actions/cache@v3
|
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
|
|
|
products
|
|
|
|
server
|
|
|
|
server-plugins
|
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
2022-11-15 05:51:46 +03:00
|
|
|
tools
|
2022-06-03 19:44:11 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
2022-04-29 19:47:22 +03:00
|
|
|
|
2022-06-03 19:44:11 +03:00
|
|
|
- name: Checking svelte sources...
|
|
|
|
run: node common/scripts/install-run-rush.js svelte-check
|
2022-04-29 08:27:17 +03:00
|
|
|
formatting:
|
2022-02-10 12:04:18 +03:00
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-10 12:04:18 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Cache build results
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-02-10 12:04:18 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
2022-04-01 08:57:22 +03:00
|
|
|
products
|
2022-02-10 12:04:18 +03:00
|
|
|
server
|
2022-02-22 12:09:13 +03:00
|
|
|
server-plugins
|
2022-02-10 12:04:18 +03:00
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
2022-11-15 05:51:46 +03:00
|
|
|
tools
|
2022-06-03 19:44:11 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
2022-02-10 12:04:18 +03:00
|
|
|
|
2022-06-03 19:44:11 +03:00
|
|
|
- name: Install...
|
|
|
|
run: node common/scripts/install-run-rush.js install
|
2022-04-29 08:27:17 +03:00
|
|
|
- name: Formatting...
|
2023-02-17 18:17:56 +03:00
|
|
|
run: node common/scripts/install-run-rush.js fast-format
|
2022-04-29 19:47:22 +03:00
|
|
|
- name: Check files formatting
|
|
|
|
run: |
|
|
|
|
echo '================================================================'
|
|
|
|
echo 'Checking for diff files'
|
|
|
|
echo '================================================================'
|
|
|
|
git diff '*.ts' '*.svelte' | cat
|
|
|
|
[ -z "$(git diff --name-only '*.ts' '*.svelte' | cat)" ]
|
2022-06-03 19:44:11 +03:00
|
|
|
echo '================================================================'
|
2022-01-25 11:25:20 +03:00
|
|
|
test:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-01-25 11:25:20 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Cache build results
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
2022-04-01 08:57:22 +03:00
|
|
|
products
|
2022-01-25 11:25:20 +03:00
|
|
|
server
|
2022-02-22 12:09:13 +03:00
|
|
|
server-plugins
|
2022-01-25 11:25:20 +03:00
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
2022-11-15 05:51:46 +03:00
|
|
|
tools
|
2022-06-03 19:44:11 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
2023-06-22 11:22:37 +03:00
|
|
|
- name: Cache Build cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ./common/temp/build-cache
|
2023-07-06 08:55:22 +03:00
|
|
|
key: build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2023-06-22 11:22:37 +03:00
|
|
|
restore-keys: |
|
2023-07-06 08:55:22 +03:00
|
|
|
build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2021-12-02 12:07:25 +03:00
|
|
|
- name: Start MongoDB
|
2023-08-11 10:23:26 +03:00
|
|
|
uses: supercharge/mongodb-github-action@v1.10.0
|
2021-12-02 12:07:25 +03:00
|
|
|
with:
|
2022-08-24 13:46:15 +03:00
|
|
|
mongodb-version: 5.0
|
2021-12-02 12:07:25 +03:00
|
|
|
|
2021-09-12 10:37:22 +03:00
|
|
|
- name: Testing...
|
2023-06-20 08:47:00 +03:00
|
|
|
run: node common/scripts/install-run-rush.js test --verbose
|
2022-01-25 11:25:20 +03:00
|
|
|
uitest:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-01-25 11:25:20 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-06-22 11:22:37 +03:00
|
|
|
- name: Cache Build cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ./common/temp/build-cache
|
2023-07-06 08:55:22 +03:00
|
|
|
key: build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2023-06-22 11:22:37 +03:00
|
|
|
restore-keys: |
|
2023-07-06 08:55:22 +03:00
|
|
|
build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Cache build results
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
2022-04-01 08:57:22 +03:00
|
|
|
products
|
2022-01-25 11:25:20 +03:00
|
|
|
server
|
2022-02-22 12:09:13 +03:00
|
|
|
server-plugins
|
2022-01-25 11:25:20 +03:00
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
2022-11-15 05:51:46 +03:00
|
|
|
tools
|
2022-06-03 19:44:11 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
2022-01-25 11:25:20 +03:00
|
|
|
|
|
|
|
- name: Installing...
|
|
|
|
run: node common/scripts/install-run-rush.js install
|
2023-06-09 13:36:55 +03:00
|
|
|
|
|
|
|
- name: Setting model version from git release...
|
|
|
|
run: node common/scripts/install-run-rush.js bump-model-version
|
|
|
|
|
|
|
|
- name: Building...
|
|
|
|
run: node common/scripts/install-run-rush.js build
|
|
|
|
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Bundle
|
2023-06-09 13:36:55 +03:00
|
|
|
run: node common/scripts/install-run-rush.js bundle
|
|
|
|
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Docker build
|
2023-06-09 13:36:55 +03:00
|
|
|
run: node common/scripts/install-run-rush.js docker:build
|
2023-08-03 20:55:02 +03:00
|
|
|
env:
|
|
|
|
DOCKER_CLI_HINTS: false
|
|
|
|
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Prepare server
|
|
|
|
run: |
|
|
|
|
cd ./tests
|
|
|
|
./prepare.sh
|
|
|
|
- name: Install Playwright
|
|
|
|
run: |
|
|
|
|
cd ./tests/sanity
|
|
|
|
node ../../common/scripts/install-run-rushx.js ci
|
|
|
|
- name: Run UI tests
|
|
|
|
run: |
|
|
|
|
cd ./tests/sanity
|
|
|
|
node ../../common/scripts/install-run-rushx.js uitest
|
2023-06-09 13:36:55 +03:00
|
|
|
# - name: Archive DB
|
|
|
|
# run: |
|
|
|
|
# cd ./tests
|
|
|
|
# ./update-snapshot-ci.sh ./tests/db_dump
|
2023-06-21 08:33:00 +03:00
|
|
|
- name: "Store docker logs"
|
2023-06-22 11:22:37 +03:00
|
|
|
if: always()
|
2023-06-21 08:33:00 +03:00
|
|
|
run: |
|
|
|
|
cd ./tests/sanity
|
|
|
|
mkdir logs
|
|
|
|
docker logs $(docker ps | grep transactor | cut -f 1 -d ' ') > logs/transactor.log
|
2023-06-22 20:56:50 +03:00
|
|
|
docker logs $(docker ps | grep account | cut -f 1 -d ' ') > logs/account.log
|
2023-06-21 08:33:00 +03:00
|
|
|
docker logs $(docker ps | grep front | cut -f 1 -d ' ') > logs/front.log
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Upload test results
|
|
|
|
if: always()
|
2022-04-09 06:32:04 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-01-25 11:25:20 +03:00
|
|
|
with:
|
|
|
|
name: playwright-results
|
2023-06-22 11:22:37 +03:00
|
|
|
path: ./tests/sanity/playwright-report/
|
|
|
|
- name: Upload Logs
|
|
|
|
if: always()
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: docker-logs
|
|
|
|
path: ./tests/sanity/logs
|
2023-06-20 08:47:00 +03:00
|
|
|
# - name: Upload DB snapshot
|
|
|
|
# if: always()
|
|
|
|
# uses: actions/upload-artifact@v3
|
|
|
|
# with:
|
|
|
|
# name: db-snapshot
|
|
|
|
# path: ./tests/db_dump
|
2022-02-23 19:10:43 +03:00
|
|
|
docker-build:
|
|
|
|
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
|
2022-06-03 19:44:11 +03:00
|
|
|
needs: [build, uitest, test, svelte-check]
|
2022-02-23 19:10:43 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-23 19:10:43 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-06-22 11:22:37 +03:00
|
|
|
- name: Cache Build cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ./common/temp/build-cache
|
2023-07-06 08:55:22 +03:00
|
|
|
key: build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2023-06-22 11:22:37 +03:00
|
|
|
restore-keys: |
|
2023-07-06 08:55:22 +03:00
|
|
|
build-cache-${{ hashFiles('./common/temp/pnpm-lock.yaml') }}
|
2022-02-23 19:10:43 +03:00
|
|
|
- name: Cache build results
|
2022-04-09 06:32:48 +03:00
|
|
|
uses: actions/cache@v3
|
2022-02-23 19:10:43 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
2022-04-01 08:57:22 +03:00
|
|
|
products
|
2022-02-23 19:10:43 +03:00
|
|
|
server
|
|
|
|
server-plugins
|
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
2022-11-15 05:51:46 +03:00
|
|
|
tools
|
2022-06-03 19:44:11 +03:00
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
2022-02-23 19:10:43 +03:00
|
|
|
|
|
|
|
- name: Installing...
|
|
|
|
run: node common/scripts/install-run-rush.js install
|
|
|
|
- name: Setting model version from git release...
|
|
|
|
run: node common/scripts/install-run-rush.js bump-model-version
|
2022-03-05 07:59:07 +03:00
|
|
|
- name: Build, to include new model version
|
2022-06-03 19:44:11 +03:00
|
|
|
run: node common/scripts/install-run-rush.js build
|
2022-02-23 19:10:43 +03:00
|
|
|
- name: Bundle
|
|
|
|
run: node common/scripts/install-run-rush.js bundle
|
|
|
|
- name: Docker build
|
|
|
|
run: node common/scripts/install-run-rush.js docker:build
|
2023-08-03 20:55:02 +03:00
|
|
|
env:
|
|
|
|
DOCKER_CLI_HINTS: false
|
2022-02-23 19:10:43 +03:00
|
|
|
- name: Login to Docker Hub
|
2023-09-14 06:23:22 +03:00
|
|
|
uses: docker/login-action@v3
|
2022-02-23 19:10:43 +03:00
|
|
|
with:
|
|
|
|
username: hardcoreeng
|
|
|
|
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Docker push staging
|
|
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
|
|
run: node common/scripts/install-run-rush.js docker:staging
|
|
|
|
- name: Docker push tag
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
|
|
run: |
|
|
|
|
echo Pushing release of tag ${{ github.ref }}
|
|
|
|
node common/scripts/install-run-rush.js docker:push
|