feat(trading): buy neb page #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- release/* | |
pull_request: | |
types: | |
- opened | |
- ready_for_review | |
- reopened | |
- synchronize | |
jobs: | |
node-modules: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-22.04 | |
name: 'Cache yarn modules' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: yarn | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }} | |
- name: yarn install | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --pure-lockfile | |
lint-format: | |
timeout-minutes: 10 | |
needs: node-modules | |
runs-on: ubuntu-22.04 | |
name: '(CI) lint + format check' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: yarn | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: develop | |
- name: Check formatting | |
run: yarn nx format:check | |
- name: Lint affected | |
run: yarn nx affected:lint --max-warnings=0 | |
- name: Build affected spec | |
run: yarn nx affected --target=build-spec | |
test-affected: | |
timeout-minutes: 30 | |
needs: build-sources | |
runs-on: ubuntu-22.04 | |
name: 'run unit test of affected apps' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: yarn | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: develop | |
- name: Setup nx | |
run: yarn global add nx@latest | |
- name: Test affected | |
run: yarn nx affected:test | |
build-sources: | |
timeout-minutes: 30 | |
needs: lint-format | |
runs-on: ubuntu-22.04 | |
name: 'Build sources of affected apps' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: yarn | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: develop | |
# See affected apps | |
- name: See affected apps | |
run: | | |
branch_slug="$(echo '${{ github.head_ref || github.ref_name }}' | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | cut -c 1-50 )" | |
python3 tools/ci/check-affected.py --github-ref="${{ github.ref }}" --branch-slug="$branch_slug" --event-name="${{ github.event_name }}" | |
- name: Verify script result | |
run: | | |
echo "Check outputs from script" | |
echo "projects: ${{ env.PROJECTS }}" | |
echo "projects-e2e: ${{ env.PROJECTS_E2E }}" | |
- name: Build affected | |
run: yarn nx affected:build || (yarn install && yarn nx affected:build) | |
outputs: | |
projects: ${{ env.PROJECTS }} | |
projects-e2e: ${{ env.PROJECTS_E2E }} | |
# check-e2e-needed: | |
# runs-on: ubuntu-latest | |
# needs: build-sources | |
# name: '(CI) check if e2e needed' | |
# outputs: | |
# run-tests: ${{ steps.check-test.outputs.e2e-needed }} | |
# steps: | |
# - name: Check branch | |
# id: check-test | |
# run: | | |
# if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
# echo "e2e-needed=true" >> $GITHUB_OUTPUT | |
# else | |
# echo "e2e-needed=false" >> $GITHUB_OUTPUT | |
# fi | |
# - name: Print result | |
# run: | | |
# echo "e2e-needed: ${{ steps.check-test.outputs.e2e-needed }}" | |
# cypress: | |
# needs: [build-sources, check-e2e-needed] | |
# name: '(CI) cypress' | |
# uses: ./.github/workflows/cypress-run.yml | |
# secrets: inherit | |
# if: needs.check-e2e-needed.outputs.run-tests == 'true' && (contains(github.event.pull_request.title, 'explorer')) | |
# with: | |
# projects: ${{ needs.build-sources.outputs.projects-e2e }} | |
# tags: '@smoke' | |
publish-dist: | |
needs: build-sources | |
name: '(CD) publish dist' | |
if: github.event_name != 'pull_request' && ((contains(github.ref, 'release/mainnet') && !contains(github.ref, 'mirror')) || contains(github.ref, 'release/testnet') || contains(github.ref, 'release/validators-testnet') || contains(github.ref, 'release/mainnet-mirror')) | |
uses: ./.github/workflows/publish-dist.yml | |
secrets: inherit | |
with: | |
projects: ${{ needs.build-sources.outputs.projects }} | |
previews: | |
needs: build-sources | |
name: '(CD) previews' | |
if: github.event_name == 'pull_request' | |
uses: ./.github/workflows/previews.yml | |
secrets: inherit | |
with: | |
projects: ${{ needs.build-sources.outputs.projects }} | |
# trading-e2e: | |
# needs: [build-sources, check-e2e-needed] | |
# name: '(CI) trading e2e python' | |
# uses: ./.github/workflows/trading-e2e-test-run.yml | |
# secrets: inherit | |
# if: needs.check-e2e-needed.outputs.run-tests == 'true' && contains(needs.build-sources.outputs.projects, 'trading') | |
# with: | |
# github-sha: ${{ github.event.pull_request.head.sha || github.sha }} | |
# test-check: | |
# name: '(CI) Final Tests check' | |
# if: ${{ always() }} | |
# needs: [cypress, trading-e2e] | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - name: Check Cypress Tests Result | |
# run: | | |
# result="${{ needs.cypress.result }}" | |
# echo "Cypress Tests Result: $result" | |
# if [[ $result != "success" && $result != "skipped" ]]; then | |
# echo "Failing due to Cypress tests." | |
# exit 1 | |
# fi | |
# - name: Check Trading E2E Tests Result | |
# run: | | |
# result="${{ needs.trading-e2e.result }}" | |
# echo "Trading E2E Tests Result: $result" | |
# if [[ $result != "success" && $result != "skipped" ]]; then | |
# echo "Failing due to Trading E2E tests." | |
# exit 1 | |
# fi | |
# - name: All Tests Passed | |
# run: echo "All specified tests have passed successfully." |