From 65f60af35e3adf8d691463eb0a726ce42460eb7f Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 30 Mar 2023 21:36:58 +0200 Subject: [PATCH] ci: move tests into one single workflow file (#2911) * try * remove lint * ci: run checks for pushes only to the main branch * fix readme --------- Co-authored-by: Jonathan Ho --- .github/workflows/bot-test.yml | 147 ------------------ .github/workflows/discordeno-test.yml | 142 ----------------- .../{gateway-test.yml => lib-check.yml} | 106 ++++++++++++- .github/workflows/lint.yml | 35 ----- .github/workflows/rest-test.yml | 147 ------------------ .github/workflows/types-test.yml | 142 ----------------- .github/workflows/utils-test.yml | 142 ----------------- README.md | 19 +-- 8 files changed, 111 insertions(+), 769 deletions(-) delete mode 100644 .github/workflows/bot-test.yml delete mode 100644 .github/workflows/discordeno-test.yml rename .github/workflows/{gateway-test.yml => lib-check.yml} (64%) delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/rest-test.yml delete mode 100644 .github/workflows/types-test.yml delete mode 100644 .github/workflows/utils-test.yml diff --git a/.github/workflows/bot-test.yml b/.github/workflows/bot-test.yml deleted file mode 100644 index 464d1cd1d..000000000 --- a/.github/workflows/bot-test.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Bot Test - -on: - pull_request: - push: - -jobs: - build-type-and-test: - name: Build Type and Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Build Type and Test - run: yarn build:type --cache-dir=".turbo" --filter=./packages/bot - - build-dist: - name: Build Dist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Type Test - run: yarn build --cache-dir=".turbo" --filter=./packages/bot - - format-unit-and-integration-test: - name: Format Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-lint-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Check Formatting - run: yarn lint --cache-dir=".turbo" --filter=./packages/bot - - test-type-unit-and-integration-test: - name: Test Type Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-unit-and-integration-test:test-type-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" --filter=./packages/bot - - # Not using matrix because test later on cant needs a specific job - bot-unit-test: - needs: build-dist - uses: ./.github/workflows/unit-test.yml - with: - package: bot - bot-e2e-test: - needs: bot-unit-test - if: ${{ github.ref == 'refs/heads/main' }} - uses: ./.github/workflows/e2e-test.yml - secrets: inherit - with: - package: bot - bot-other-runtime-test: - needs: bot-unit-test - uses: ./.github/workflows/other-runtime-unit-test.yml - with: - package: bot diff --git a/.github/workflows/discordeno-test.yml b/.github/workflows/discordeno-test.yml deleted file mode 100644 index 5c0b71ec9..000000000 --- a/.github/workflows/discordeno-test.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Discordeno Test - -on: - pull_request: - push: - -jobs: - build-type-and-test: - name: Build Type and Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Build Type and Test - run: yarn build:type --cache-dir=".turbo" --filter=./packages/discordeno - - build-dist: - name: Build Dist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Type Test - run: yarn build --cache-dir=".turbo" --filter=./packages/discordeno - - format-unit-and-integration-test: - name: Format Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-lint-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Check Formatting - run: yarn lint --cache-dir=".turbo" --filter=./packages/discordeno - - test-type-unit-and-integration-test: - name: Test Type Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-unit-and-integration-test:test-type-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" --filter=./packages/discordeno - - # Not using matrix because test later on cant needs a specific job - discordeno-unit-test: - name: Discordeno - needs: build-dist - uses: ./.github/workflows/unit-test.yml - with: - package: discordeno - discordeno-other-runtime-test: - name: Discordeno - needs: discordeno-unit-test - uses: ./.github/workflows/other-runtime-unit-test.yml - with: - package: discordeno diff --git a/.github/workflows/gateway-test.yml b/.github/workflows/lib-check.yml similarity index 64% rename from .github/workflows/gateway-test.yml rename to .github/workflows/lib-check.yml index bed138ca3..77be1d5b6 100644 --- a/.github/workflows/gateway-test.yml +++ b/.github/workflows/lib-check.yml @@ -1,8 +1,10 @@ -name: Gateway Test +name: Library Checks on: pull_request: push: + branches: + - main jobs: build-type-and-test: @@ -30,7 +32,7 @@ jobs: path: .turbo key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - name: Build Type and Test - run: yarn build:type --cache-dir=".turbo" --filter=./packages/gateway + run: yarn build:type --cache-dir=".turbo" build-dist: name: Build Dist @@ -57,7 +59,7 @@ jobs: path: .turbo key: ${{ runner.os }}-turbo-build-${{ github.sha }} - name: Type Test - run: yarn build --cache-dir=".turbo" --filter=./packages/gateway + run: yarn build --cache-dir=".turbo" format-unit-and-integration-test: name: Format Test @@ -91,7 +93,7 @@ jobs: path: .turbo key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - name: Check Formatting - run: yarn lint --cache-dir=".turbo" --filter=./packages/gateway + run: yarn lint --cache-dir=".turbo" test-type-unit-and-integration-test: name: Test Type Test @@ -125,9 +127,56 @@ jobs: path: .turbo key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" --filter=./packages/gateway + run: yarn test:test-type --cache-dir=".turbo" # Not using matrix because test later on cant needs a specific job + bot-unit-test: + name: Bot + needs: build-dist + uses: ./.github/workflows/unit-test.yml + with: + package: bot + bot-e2e-test: + name: Bot + needs: bot-unit-test + if: ${{ github.ref == 'refs/heads/main' }} + uses: ./.github/workflows/e2e-test.yml + secrets: inherit + with: + package: bot + bot-other-runtime-test: + name: Bot + needs: bot-unit-test + uses: ./.github/workflows/other-runtime-unit-test.yml + with: + package: bot + + client-unit-test: + name: Client + needs: build-dist + uses: ./.github/workflows/unit-test.yml + with: + package: client + client-other-runtime-test: + name: Client + needs: client-unit-test + uses: ./.github/workflows/other-runtime-unit-test.yml + with: + package: client + + discordeno-unit-test: + name: Discordeno + needs: build-dist + uses: ./.github/workflows/unit-test.yml + with: + package: discordeno + discordeno-other-runtime-test: + name: Discordeno + needs: discordeno-unit-test + uses: ./.github/workflows/other-runtime-unit-test.yml + with: + package: discordeno + gateway-unit-test: name: Gateway needs: build-dist @@ -146,3 +195,50 @@ jobs: uses: ./.github/workflows/other-runtime-unit-test.yml with: package: gateway + + rest-unit-test: + name: Rest + needs: build-dist + uses: ./.github/workflows/unit-test.yml + with: + package: rest + rest-e2e-test: + name: Rest + needs: rest-unit-test + if: ${{ github.ref == 'refs/heads/main' }} + uses: ./.github/workflows/e2e-test.yml + secrets: inherit + with: + package: rest + rest-other-runtime-test: + name: Rest + needs: rest-unit-test + uses: ./.github/workflows/other-runtime-unit-test.yml + with: + package: rest + + types-unit-test: + name: Types + needs: build-dist + uses: ./.github/workflows/unit-test.yml + with: + package: types + types-other-runtime-test: + name: Types + needs: types-unit-test + uses: ./.github/workflows/other-runtime-unit-test.yml + with: + package: types + + utils-unit-test: + name: Utils + needs: build-dist + uses: ./.github/workflows/unit-test.yml + with: + package: utils + utils-other-runtime-test: + name: Utils + needs: utils-unit-test + uses: ./.github/workflows/other-runtime-unit-test.yml + with: + package: utils diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 1593603e9..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Lint - -on: - push: - pull_request: - -jobs: - run-linters: - name: Run linters - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v2 - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Run linters - uses: wearerequired/lint-action@v2 - with: - auto_fix: true - eslint: true - eslint_extensions: "js,ts" - prettier: true diff --git a/.github/workflows/rest-test.yml b/.github/workflows/rest-test.yml deleted file mode 100644 index 7065b5b7a..000000000 --- a/.github/workflows/rest-test.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Rest Test - -on: - pull_request: - push: - -jobs: - build-type-and-test: - name: Build Type and Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Build Type and Test - run: yarn build:type --cache-dir=".turbo" --filter=./packages/rest - - build-dist: - name: Build Dist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Type Test - run: yarn build --cache-dir=".turbo" --filter=./packages/rest - - format-unit-and-integration-test: - name: Format Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-lint-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Check Formatting - run: yarn lint --cache-dir=".turbo" --filter=./packages/rest - - test-type-unit-and-integration-test: - name: Test Type Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-unit-and-integration-test:test-type-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" --filter=./packages/rest - - # Not using matrix because test later on cant needs a specific job - rest-unit-test: - needs: build-dist - uses: ./.github/workflows/unit-test.yml - with: - package: rest - rest-e2e-test: - needs: rest-unit-test - if: ${{ github.ref == 'refs/heads/main' }} - uses: ./.github/workflows/e2e-test.yml - secrets: inherit - with: - package: rest - rest-other-runtime-test: - needs: rest-unit-test - uses: ./.github/workflows/other-runtime-unit-test.yml - with: - package: rest diff --git a/.github/workflows/types-test.yml b/.github/workflows/types-test.yml deleted file mode 100644 index 4f6558341..000000000 --- a/.github/workflows/types-test.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Types Test - -on: - pull_request: - push: - -jobs: - build-type-and-test: - name: Build Type and Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Build Type and Test - run: yarn build:type --cache-dir=".turbo" --filter=./packages/types - - build-dist: - name: Build Dist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Type Test - run: yarn build --cache-dir=".turbo" --filter=./packages/types - - format-unit-and-integration-test: - name: Format Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-lint-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Check Formatting - run: yarn lint --cache-dir=".turbo" --filter=./packages/types - - test-type-unit-and-integration-test: - name: Test Type Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-unit-and-integration-test:test-type-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" --filter=./packages/types - - # Not using matrix because test later on cant needs a specific job - types-unit-test: - name: Types - needs: build-dist - uses: ./.github/workflows/unit-test.yml - with: - package: types - types-other-runtime-test: - name: Types - needs: types-unit-test - uses: ./.github/workflows/other-runtime-unit-test.yml - with: - package: types diff --git a/.github/workflows/utils-test.yml b/.github/workflows/utils-test.yml deleted file mode 100644 index 95b8c903d..000000000 --- a/.github/workflows/utils-test.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Utils Test - -on: - pull_request: - push: - -jobs: - build-type-and-test: - name: Build Type and Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Build Type and Test - run: yarn build:type --cache-dir=".turbo" --filter=./packages/utils - - build-dist: - name: Build Dist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Type Test - run: yarn build --cache-dir=".turbo" --filter=./packages/utils - - format-unit-and-integration-test: - name: Format Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-lint-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Check Formatting - run: yarn lint --cache-dir=".turbo" --filter=./packages/utils - - test-type-unit-and-integration-test: - name: Test Type Test - runs-on: ubuntu-latest - needs: build-type-and-test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-unit-and-integration-test:test-type-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} - - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" --filter=./packages/utils - - # Not using matrix because test later on cant needs a specific job - utils-unit-test: - name: Utils - needs: build-dist - uses: ./.github/workflows/unit-test.yml - with: - package: utils - utils-other-runtime-test: - name: Utils - needs: utils-unit-test - uses: ./.github/workflows/other-runtime-unit-test.yml - with: - package: utils diff --git a/README.md b/README.md index 3cc613875..ea08700ba 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Discord API library for [Node.JS](https://nodejs.org), [Deno](https://deno.land) [![Discord](https://img.shields.io/discord/785384884197392384?color=7289da&logo=discord&logoColor=dark)](https://discord.com/invite/5vBgXk3UcZ) [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK)](https://codecov.io/gh/discordeno/discordeno) +![action status](https://github.com/discordeno/discordeno/actions/workflows/lib-check.yml/badge.svg?event=push) ## Tips @@ -14,14 +15,14 @@ Discord API library for [Node.JS](https://nodejs.org), [Deno](https://deno.land) ## Packages -| Package | npm | Tests | Coverage | -| ------------------------------------------------------------------------ | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [discordeno](https://www.npmjs.com/package/discordeno) | ![npm (scoped)](https://img.shields.io/npm/v/discordeno) | ![action status](https://github.com/discordeno/discordeno/actions/workflows/discordeno-test.yml/badge.svg?event=push) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=discordeno)](https://codecov.io/gh/discordeno/discordeno) | -| [@discordeno/types](https://www.npmjs.com/package/@discordeno/types) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/types) | ![action status](https://github.com/discordeno/discordeno/actions/workflows/types-test.yml/badge.svg?event=push) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=types)](https://codecov.io/gh/discordeno/discordeno) | -| [@discordeno/utils](https://www.npmjs.com/package/@discordeno/utils) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/utils) | ![action status](https://github.com/discordeno/discordeno/actions/workflows/utils-test.yml/badge.svg?event=push) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=utils)](https://codecov.io/gh/discordeno/discordeno) | -| [@discordeno/rest](https://www.npmjs.com/package/@discordeno/rest) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/rest) | ![action status](https://github.com/discordeno/discordeno/actions/workflows/rest-test.yml/badge.svg?event=push) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=rest)](https://codecov.io/gh/discordeno/discordeno) | -| [@discordeno/gateway](https://www.npmjs.com/package/@discordeno/gateway) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/gateway) | ![action status](https://github.com/discordeno/discordeno/actions/workflows/gateway-test.yml/badge.svg?event=push) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=gateway)](https://codecov.io/gh/discordeno/discordeno) | -| [@discordeno/bot](https://www.npmjs.com/package/@discordeno/bot) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/bot) | ![action status](https://github.com/discordeno/discordeno/actions/workflows/bot-test.yml/badge.svg?event=push) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=bot)](https://codecov.io/gh/discordeno/discordeno) | +| Package | npm | Tests | +| ------------------------------------------------------------------------ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [discordeno](https://www.npmjs.com/package/discordeno) | ![npm (scoped)](https://img.shields.io/npm/v/discordeno) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=discordeno)](https://codecov.io/gh/discordeno/discordeno) | +| [@discordeno/types](https://www.npmjs.com/package/@discordeno/types) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/types) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=types)](https://codecov.io/gh/discordeno/discordeno) | +| [@discordeno/utils](https://www.npmjs.com/package/@discordeno/utils) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/utils) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=utils)](https://codecov.io/gh/discordeno/discordeno) | +| [@discordeno/rest](https://www.npmjs.com/package/@discordeno/rest) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/rest) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=rest)](https://codecov.io/gh/discordeno/discordeno) | +| [@discordeno/gateway](https://www.npmjs.com/package/@discordeno/gateway) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/gateway) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=gateway)](https://codecov.io/gh/discordeno/discordeno) | +| [@discordeno/bot](https://www.npmjs.com/package/@discordeno/bot) | ![npm (scoped)](https://img.shields.io/npm/v/@discordeno/bot) | [![codecov](https://codecov.io/gh/discordeno/discordeno/branch/main/graph/badge.svg?token=SQI9OYJ7AK&flag=bot)](https://codecov.io/gh/discordeno/discordeno) | ## Features @@ -29,7 +30,7 @@ Discordeno is actively maintained to guarantee **excellent performance, latest f - **Simple, Efficient, and Lightweight**: Discordeno is lightweight, simple to use, and adaptable. - By default: No caching. -- **Functional API**: +- **Functional API**: - The functional API eliminates the challenges of extending built-in classes and inheritance while ensuring overall simple but performant code. - **Cross Runtime**: Supports the Node.js, Deno, and Bun runtimes. - **Standalone components**: Discordeno offers the option to have practically any component of a bot as a separate