Skip to content

add typeshare

add typeshare #1535

Workflow file for this run

name: CI/CD
on:
pull_request:
paths-ignore:
- '.vscode/**'
- 'docs/**'
- 'env/**'
- '**/*.md'
- '.gitpod.yml'
push:
branches:
- master
paths-ignore:
- '.vscode/**'
- 'docs/**'
- 'env/**'
- '**/*.md'
- '.gitpod.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: "yarn"
- run: npm install -g yarn
- run: yarn install --frozen-lockfile
- run: yarn run lint-ci
env:
NODE_ENV: production
- name: cargo-install
uses: baptiste0928/cargo-install@v1
with:
crate: typeshare-cli
version: "1.7.0"
- name: Ensure generated code is up to date
run: ./scripts/codegen.sh && git diff --exit-code
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
continue-on-error: true
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v1
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: "yarn"
- run: npm install -g yarn
- run: yarn install --frozen-lockfile
- run: yarn workspace ott-server run sequelize db:migrate
env:
NODE_ENV: test
- run: yarn workspace ott-client build
- run: yarn run test
env:
REDIS_HOST: localhost
REDIS_PORT: 6379
- name: Upload coverage report
uses: codecov/codecov-action@v2
with:
files: ./common/coverage/coverage-final.json,./client/coverage/coverage-final.json,./server/coverage/coverage-final.json
deploy-docker:
runs-on: ubuntu-latest
name: Deploy docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [test, lint]
steps:
- uses: actions/checkout@v1
- name: Log in to Dockerhub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "dyc3" --password-stdin
touch env/production.env
- name: Build image
run: |
docker-compose -f docker/docker-compose.yml up -d --build
docker commit opentogethertube opentogethertube
docker-compose -f docker/docker-compose.yml down
docker tag opentogethertube dyc3/opentogethertube:latest
- name: Push to Dockerhub
run: docker push dyc3/opentogethertube:latest
deploy-fly:
runs-on: ubuntu-latest
name: Deploy on fly.io
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [test, lint]
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --config deploy/fly.prod.monolith.toml --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}