ci: fix bundle size job not working on external PRs #3430
Workflow file for this run
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: | |
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@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
check-latest: true | |
cache: "yarn" | |
cache-dependency-path: "./yarn.lock" | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node_modules-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
node_modules-${{ runner.os }}-node-${{ matrix.node-version }}- | |
- run: corepack enable | |
- run: yarn install --immutable | |
- run: yarn run lint-ci | |
env: | |
NODE_ENV: production | |
- name: cargo-install | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: typeshare-cli | |
version: "1.7.0" | |
- name: Ensure generated code is up to date | |
run: ./scripts/codegen.sh && git diff --exit-code | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: typos-action | |
uses: crate-ci/typos@v1.19.0 | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
fail-fast: true | |
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@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
check-latest: true | |
cache: "yarn" | |
cache-dependency-path: "./yarn.lock" | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node_modules-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
node_modules-${{ runner.os }}-node-${{ matrix.node-version }}- | |
- run: corepack enable | |
- run: yarn install --immutable | |
- run: yarn workspace ott-server run sequelize db:migrate | |
env: | |
NODE_ENV: test | |
- run: yarn run build | |
- run: yarn run test | |
env: | |
REDIS_HOST: localhost | |
REDIS_PORT: 6379 | |
- name: Collect coverage reports | |
id: collect-coverage | |
run: | | |
echo "files=$(find . -name coverage-final.json | sed 's/\.\///g' | tr '\n' ',')" >> "$GITHUB_OUTPUT" | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ${{ steps.collect-coverage.outputs.files }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
grafana-compatibilitycheck: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: [ott-vis-panel, ott-vis-datasource] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
cache-dependency-path: "./yarn.lock" | |
- run: corepack enable | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build plugin | |
run: yarn workspace ${{ matrix.package }} build | |
- name: Compatibility check | |
run: npx @grafana/levitate@latest is-compatible --path packages/${{ matrix.package }}/src/module.ts --target @grafana/data,@grafana/ui,@grafana/runtime | |
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@v4 | |
- 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-staging-monolith: | |
runs-on: ubuntu-latest | |
name: Deploy Monolith on fly.io (staging) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: [test, lint] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --config deploy/fly.staging.monolith.toml --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
deploy-fly-staging-balancer: | |
runs-on: ubuntu-latest | |
name: Deploy Balancer on fly.io (staging) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: [test, lint, deploy-fly-staging-monolith] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --config deploy/fly.staging.balancer.toml --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
deploy-fly-prod-monolith: | |
runs-on: ubuntu-latest | |
name: Deploy Monolith on fly.io (prod) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: [test, lint] | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 }} | |
deploy-fly-prod-balancer: | |
runs-on: ubuntu-latest | |
name: Deploy Balancer on fly.io (prod) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: [test, lint, deploy-fly-prod-monolith] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --config deploy/fly.prod.balancer.toml --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |