Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use separate jobs for each task #180

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: corepack yarn
- run: corepack yarn eslint .

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: corepack yarn
- run: corepack yarn prettier --check .

tsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: corepack yarn
- run: corepack yarn tsd

vitest:
runs-on: ubuntu-latest
strategy:
matrix:
node:
- 18
- 20
- 22
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: corepack yarn
- run: corepack yarn vitest run --coverage ./test/unit
37 changes: 10 additions & 27 deletions .github/workflows/main.yml → .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Integration tests

on:
workflow_dispatch:
Expand All @@ -11,7 +11,6 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
# Integration tests are not yet ready to run in parallel
max-parallel: 1
Expand All @@ -20,53 +19,37 @@ jobs:
- 18
- 20.15.1
- 22.3.0

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- run: corepack yarn
- run: corepack yarn lint

- name: Download cloudflared
run: |
curl -fsSLo cloudflared-linux-amd64 https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
chmod +x cloudflared-linux-amd64

- run: curl -fsSLo cloudflared-linux-amd64 https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
- run: chmod +x cloudflared-linux-amd64
# can be used for debugging:
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- run: corepack yarn test-all
# - uses: mxschmitt/action-tmate@v3
- run: corepack yarn vitest run --coverage
env:
TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_KEY }}
TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_SECRET }}
NODE_OPTIONS: --trace-deprecation --trace-warnings
CLOUDFLARED_PATH: ./cloudflared-linux-amd64
DEBUG: 'transloadit:*'

- name: Generate the badge from the json-summary
run: node test/generate-coverage-badge.js coverage/coverage-summary.json

- name: Move HTML report and badge to the correct location
run: |
mv coverage/lcov-report static-build
mv coverage-badge.svg static-build/

- run: node test/generate-coverage-badge.js coverage/coverage-summary.json
- run: mv coverage/lcov-report static-build
- run: mv coverage-badge.svg static-build/
# *** BEGIN PUBLISH STATIC SITE STEPS ***
# Use the standard checkout action to check out the destination repo to a separate directory
# See https://github.com/mifi/github-action-push-static
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.COVERAGE_REPO_SSH_PRIVATE_KEY }}
repository: transloadit/node-sdk-coverage
path: static-files-destination

# Push coverage data
- if: matrix.node == '18'
- if: matrix.node == '22.3.0'
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/pr.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"test-unit": "vitest run --coverage ./test/unit",
"test-integration": "vitest run ./test/integration",
"tsd": "tsd",
"test-all": "npm run tsd && vitest run --coverage --coverageReporters json lcov text clover json-summary --forceExit",
"test-all": "npm run tsd && vitest run --coverage --forceExit",
"test": "npm run tsd && npm run test-unit",
"fix:formatting": "prettier --write .",
"lint:formatting": "prettier --check ."
Expand Down
1 change: 1 addition & 0 deletions vitest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default defineConfig({
test: {
coverage: {
include: 'src',
reporter: ['json', 'lcov', 'text', 'clover', 'json-summary'],
},
globals: true,
},
Expand Down