Skip to content

Merge pull request #586 from tradingstrategy-ai/prerender-chains #1936

Merge pull request #586 from tradingstrategy-ai/prerender-chains

Merge pull request #586 from tradingstrategy-ai/prerender-chains #1936

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
- 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
# use separate build step to avoid playwright timeout issue
- name: Build SvelteKit vite app
run: npm run build
# skip build in test step
- name: Run Tests
run: npm run test --skip-build
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 }}