Skip to content

Merge pull request #502 from tradingstrategy-ai/more-charts #1716

Merge pull request #502 from tradingstrategy-ai/more-charts

Merge pull request #502 from tradingstrategy-ai/more-charts #1716

Workflow file for this run

name: Test and build container
on:
push:
branches: [master]
tags: [v*]
pull_request: # we can use docker image in PR for testing
branches: [master]
jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.14
cache: npm
- name: Install dependencies
run: npm ci
- name: Code format check
run: npm run format:check
test:
runs-on: ubuntu-latest
steps:
- name: Set up SSH deploy keys for ChartIQ & fonts
uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.SSH_DEPLOY_KEY_CHARTIQ }}
${{ secrets.SSH_DEPLOY_KEY_FONTS }}
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-node@v3
with:
node-version: 18.14
cache: npm
cache-dependency-path: |
package-lock.json
deps/trade-executor-frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Setup submodules
run: bash scripts/build-deps.sh
- name: Install Playwright
run: npx playwright install chromium --with-deps
- name: Run Tests
run: npm run test
build:
runs-on: ubuntu-latest
# 2023-02 disable because tests are too flaky and do not pass on CI at all
# needs: test
# Skip build on master push
if: github.event_name != 'push' || github.ref != 'refs/heads/master'
env:
REGISTRY: ghcr.io
steps:
- name: Set up SSH deploy keys for ChartIQ & fonts
uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.SSH_DEPLOY_KEY_CHARTIQ }}
${{ secrets.SSH_DEPLOY_KEY_FONTS }}
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Read metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Log in to Github Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
ssh: |
default=${{ env.SSH_AUTH_SOCK }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# experimental: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max
# https://github.com/docker/build-push-action/issues/557
build-args: |
FONT_ZIP_DOWNLOAD_URL=${{ secrets.FONT_ZIP_DOWNLOAD_URL }}