Test: clean up CI and test (#2555)

* style: format Deno.test\("(.+)", async \(\) => \{\n([\S\s]*?)^\}\);

* style: format Deno.test\("(.+)", \(\) => \{\n([\S\s]*?)^\}\);

* style: format Deno.test\("(.+)", async \(t\) => \{\n([\S\s]*?)^\}\);

* style: format async function

* chore: turn all to async

* chore: format add t

* style: function format

* chore: add integration and unit test difference

* ci: combine test

* ci: remove if

* ci: add parallel flag

* ci: add UNIT_TEST_GUILD_ID

* ci: static deno version

* ci: add concurrency to Integration test

* ci: bump actions/checkout to v3
This commit is contained in:
Jonathan Ho
2022-10-26 10:41:26 -05:00
committed by GitHub
parent c07f2454ef
commit 1c7859fea9
56 changed files with 860 additions and 675 deletions
-19
View File
@@ -1,19 +0,0 @@
name: Check Formatting
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
deno: ["v1.x"]
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@main
with:
deno-version: ${{ matrix.deno }}
- name: Check Formatting
run: deno fmt --check
+50 -24
View File
@@ -3,40 +3,70 @@ name: Test
on:
pull_request:
push:
paths:
- "handlers/**"
- "helpers/**"
- "plugins/**"
- "packages/**"
- "rest/**"
- "tests/**"
- "transformers/**"
- "template/**"
- "types/**"
- "util/**"
- "gateway/**"
jobs:
test:
format-test:
name: Format Test
runs-on: ubuntu-latest
strategy:
matrix:
deno: ["v1.x"]
steps:
- uses: actions/checkout@v2
- run: git submodule update --init --recursive
- uses: actions/checkout@v3
- uses: denoland/setup-deno@main
with:
deno-version: ${{ matrix.deno }}
deno-version: v1.x
- name: Check Formatting
run: deno fmt --check
type-test:
name: Type Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@main
with:
deno-version: v1.x
- name: Check dependencies
run: deno check mod.ts
- name: Check plugins
run: deno check plugins/mod.ts
- name: Check Templates
run: deno check template/beginner/mod.ts template/minimal/mod.ts
- name: Run test script for maintainers
integration-test:
name: Integration Test
runs-on: ubuntu-latest
concurrency: integration-test
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@main
with:
deno-version: v1.x
- name: Run integration
# if: ${{ github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }}
run: deno test --coverage=coverage -A tests/
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
UNIT_TEST_GUILD_ID: ${{ secrets.UNIT_TEST_GUILD_ID }}
TEST_ENV: INTEGRATION
PROXY_REST_SECRET: ${{ secrets.PROXY_REST_SECRET }}
PROXY_REST_URL: ${{ secrets.PROXY_REST_URL }}
- name: Create coverage report
if: github.ref == 'refs/heads/main'
run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov
- name: Collect and upload the coverage report
if: github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v1.0.10
with:
file: ./coverage.lcov
unit-test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@main
with:
deno-version: v1.x
- name: Run integration
run: deno test --coverage=coverage --parallel -A tests/
env:
TEST_ENV: UNIT
- name: Create coverage report
if: github.ref == 'refs/heads/main'
run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov
@@ -45,7 +75,3 @@ jobs:
uses: codecov/codecov-action@v1.0.10
with:
file: ./coverage.lcov
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
PROXY_REST_SECRET: ${{ secrets.PROXY_REST_SECRET }}
PROXY_REST_URL: ${{ secrets.PROXY_REST_URL }}