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:
|
|
|
|
|
2023-10-07 13:38:21 +03:00
|
|
|
env:
|
|
|
|
CacheFolders: |
|
|
|
|
common
|
|
|
|
deploy
|
|
|
|
dev
|
|
|
|
models
|
|
|
|
packages
|
|
|
|
plugins
|
|
|
|
pods
|
|
|
|
products
|
|
|
|
server
|
|
|
|
server-plugins
|
|
|
|
templates
|
|
|
|
tests
|
|
|
|
rush.json
|
|
|
|
.prettierrc
|
|
|
|
tools
|
2024-02-23 08:37:22 +03:00
|
|
|
|
2021-09-11 09:51:51 +03:00
|
|
|
# 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:
|
|
|
|
runs-on: ubuntu-latest
|
2024-04-02 17:17:38 +03:00
|
|
|
timeout-minutes: 60
|
2021-09-11 09:51:51 +03:00
|
|
|
steps:
|
2023-09-05 08:32:12 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-03 19:44:11 +03:00
|
|
|
with:
|
2024-02-23 08:37:22 +03:00
|
|
|
fetch-depth: 0
|
|
|
|
filter: tree:0
|
2024-02-07 08:20:54 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2024-02-06 05:57:31 +03:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Cache node modules
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
2023-11-29 12:30:16 +03:00
|
|
|
cache-name: cache-node-platform
|
2022-01-25 11:25:20 +03:00
|
|
|
with:
|
2023-06-22 11:22:37 +03:00
|
|
|
path: |
|
2023-10-07 13:38:21 +03:00
|
|
|
common/temp
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
2022-01-25 11:25:20 +03:00
|
|
|
restore-keys: |
|
2023-10-07 13:38:21 +03:00
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/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
|
|
|
|
|
2024-01-23 19:18:36 +03:00
|
|
|
- name: Model version from git tags
|
|
|
|
run: node common/scripts/install-run-rush.js model-version
|
2024-02-23 08:37:22 +03:00
|
|
|
|
2022-06-02 20:00:00 +03:00
|
|
|
- name: Building...
|
2024-02-23 08:37:22 +03:00
|
|
|
run: node common/scripts/install-run-rush.js build -p 20
|
2022-01-25 11:25:20 +03:00
|
|
|
|
2024-02-23 08:37:22 +03:00
|
|
|
- name: Bundle...
|
|
|
|
run: node common/scripts/install-run-rush.js bundle -p 20
|
|
|
|
|
|
|
|
- name: Validate...
|
|
|
|
run: node common/scripts/install-run-rush.js validate -p 20
|
2023-06-09 13:36:55 +03:00
|
|
|
|
2023-10-07 13:38:21 +03:00
|
|
|
- name: Cache build results
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
2023-10-07 13:38:21 +03:00
|
|
|
path: ${{ env.CacheFolders}}
|
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
|
2024-04-02 17:17:38 +03:00
|
|
|
timeout-minutes: 60
|
2022-04-29 19:47:22 +03:00
|
|
|
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
|
2024-02-23 08:37:22 +03:00
|
|
|
filter: tree:0
|
2022-04-29 19:47:22 +03:00
|
|
|
|
2024-02-07 08:20:54 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2024-02-06 05:57:31 +03:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
|
2022-04-29 19:47:22 +03:00
|
|
|
- name: Cache build results
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-04-29 19:47:22 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
2023-10-07 13:38:21 +03:00
|
|
|
path: ${{ env.CacheFolders}}
|
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 }}
|
|
|
|
- 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
|
2024-04-02 17:17:38 +03:00
|
|
|
timeout-minutes: 60
|
2022-02-10 12:04:18 +03:00
|
|
|
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
|
2024-02-07 08:20:54 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2024-02-06 05:57:31 +03:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
2022-02-10 12:04:18 +03:00
|
|
|
- name: Cache build results
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-02-10 12:04:18 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
2023-10-07 13:38:21 +03:00
|
|
|
path: ${{ env.CacheFolders}}
|
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
|
|
|
|
2024-03-11 07:24:46 +03:00
|
|
|
- name: Apply templates...
|
|
|
|
run: node common/scripts/install-run-rush.js apply-templates
|
|
|
|
|
|
|
|
- name: Check templates
|
|
|
|
run: |
|
|
|
|
echo '================================================================'
|
|
|
|
echo 'Checking for diff files'
|
|
|
|
echo '================================================================'
|
|
|
|
git diff '*.js' '*.ts' '*.svelte' '*.json' | cat
|
|
|
|
[ -z "$(git diff --name-only '*.js' '*.ts' '*.svelte' '*.json' | cat)" ]
|
|
|
|
echo '================================================================'
|
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 '================================================================'
|
2024-03-11 07:24:46 +03:00
|
|
|
git diff '*.js' '*.ts' '*.svelte' '*.json' | cat
|
|
|
|
[ -z "$(git diff --name-only '*.js' '*.ts' '*.svelte' '*.json' | 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
|
2024-04-02 17:17:38 +03:00
|
|
|
timeout-minutes: 60
|
2022-01-25 11:25:20 +03:00
|
|
|
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
|
2024-02-23 08:37:22 +03:00
|
|
|
filter: tree:0
|
2024-02-07 08:20:54 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2024-02-06 05:57:31 +03:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
2022-01-25 11:25:20 +03:00
|
|
|
- name: Cache build results
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
|
|
|
cache-name: cache-build-results
|
|
|
|
with:
|
2023-10-07 13:38:21 +03:00
|
|
|
path: ${{ env.CacheFolders}}
|
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 }}
|
2024-02-23 08:37:22 +03:00
|
|
|
|
2023-12-02 04:26:09 +03:00
|
|
|
- name: Prepare server
|
|
|
|
run: |
|
|
|
|
cd ./tests
|
2023-12-04 19:03:21 +03:00
|
|
|
./prepare-tests.sh
|
2021-09-12 10:37:22 +03:00
|
|
|
- name: Testing...
|
2024-02-12 19:57:11 +03:00
|
|
|
run: node common/scripts/install-run-rush.js test
|
2023-12-02 04:26:09 +03:00
|
|
|
env:
|
|
|
|
ELASTIC_URL: 'http://localhost:9201'
|
|
|
|
MONGO_URL: 'mongodb://localhost:27018'
|
2022-01-25 11:25:20 +03:00
|
|
|
uitest:
|
|
|
|
runs-on: ubuntu-latest
|
2024-04-02 17:17:38 +03:00
|
|
|
timeout-minutes: 60
|
2022-01-25 11:25:20 +03:00
|
|
|
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
|
2024-02-23 08:37:22 +03:00
|
|
|
filter: tree:0
|
2024-02-07 08:20:54 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2024-02-06 05:57:31 +03:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
2024-02-23 08:37:22 +03:00
|
|
|
- name: Cache node modules
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-01-25 11:25:20 +03:00
|
|
|
env:
|
2024-02-23 08:37:22 +03:00
|
|
|
cache-name: cache-node-platform
|
2022-01-25 11:25:20 +03:00
|
|
|
with:
|
2024-02-23 08:37:22 +03:00
|
|
|
path: |
|
|
|
|
common/temp
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
|
|
|
|
- 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: Docker Build
|
|
|
|
run: node common/scripts/install-run-rush.js docker:build -p 20
|
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-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()
|
2024-02-29 10:17:49 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
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/
|
2023-11-22 12:14:26 +03:00
|
|
|
- name: Get Allure history
|
2023-11-23 08:53:07 +03:00
|
|
|
uses: actions/checkout@v4
|
2024-02-29 10:17:49 +03:00
|
|
|
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
|
2023-11-22 12:14:26 +03:00
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
ref: gh-pages
|
|
|
|
path: gh-pages
|
2023-11-12 19:24:29 +03:00
|
|
|
- name: Generates Allure Report
|
|
|
|
uses: simple-elf/allure-report-action@master
|
|
|
|
if: always()
|
|
|
|
id: allure-report
|
|
|
|
with:
|
|
|
|
allure_results: ./tests/sanity/allure-results/
|
|
|
|
gh_pages: gh-pages
|
|
|
|
allure_report: allure-report
|
|
|
|
allure_history: allure-history
|
|
|
|
- name: Upload allure test results
|
|
|
|
if: always()
|
2024-02-29 10:17:49 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-11-12 19:24:29 +03:00
|
|
|
with:
|
|
|
|
name: allure-report
|
|
|
|
path: ./allure-report/
|
|
|
|
- name: Deploy report to Github Pages
|
2024-02-29 10:17:49 +03:00
|
|
|
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
|
2023-11-14 10:46:54 +03:00
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
2023-11-14 12:00:06 +03:00
|
|
|
with:
|
2023-11-12 19:24:29 +03:00
|
|
|
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
PUBLISH_BRANCH: gh-pages
|
|
|
|
PUBLISH_DIR: allure-history
|
2023-06-22 11:22:37 +03:00
|
|
|
- name: Upload Logs
|
|
|
|
if: always()
|
2024-02-29 10:17:49 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-06-22 11:22:37 +03:00
|
|
|
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
|
2024-01-20 07:00:16 +03:00
|
|
|
docker-build:
|
2024-02-23 08:37:22 +03:00
|
|
|
needs: [build, test, svelte-check, uitest]
|
2022-02-23 19:10:43 +03:00
|
|
|
runs-on: ubuntu-latest
|
2024-04-02 17:17:38 +03:00
|
|
|
timeout-minutes: 60
|
2022-02-23 19:10:43 +03:00
|
|
|
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
|
2024-02-23 08:37:22 +03:00
|
|
|
filter: tree:0
|
2024-02-07 08:20:54 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2024-02-06 05:57:31 +03:00
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
2024-02-23 08:37:22 +03:00
|
|
|
- name: Cache node modules
|
2024-01-18 08:45:06 +03:00
|
|
|
uses: actions/cache@v4
|
2022-02-23 19:10:43 +03:00
|
|
|
env:
|
2024-02-23 08:37:22 +03:00
|
|
|
cache-name: cache-node-platform
|
2022-02-23 19:10:43 +03:00
|
|
|
with:
|
2024-02-23 08:37:22 +03:00
|
|
|
path: |
|
|
|
|
common/temp
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
|
2024-01-23 19:18:36 +03:00
|
|
|
- name: Installing...
|
|
|
|
run: node common/scripts/install-run-rush.js install
|
|
|
|
|
|
|
|
- name: Model version from git tags
|
|
|
|
run: node common/scripts/install-run-rush.js model-version
|
|
|
|
|
2022-02-23 19:10:43 +03:00
|
|
|
- name: Docker build
|
2024-02-23 08:37:22 +03:00
|
|
|
run: node common/scripts/install-run-rush.js docker:build -p 20
|
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
|
2024-02-03 13:50:10 +03:00
|
|
|
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
|
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
|