Files
discordeno/.github/workflows/test.yml
2022-12-03 15:57:06 +08:00

151 lines
4.8 KiB
YAML

name: Test
on:
pull_request:
push:
jobs:
format-test:
name: Format 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 "::set-output name=dir::$(yarn config get cacheFolder)"
- 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 }}
restore-keys: |
${{ runner.os }}-turbo-lint-
- name: Check Formatting
run: yarn lint --cache-dir=".turbo"
type-test:
name: Type 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 "::set-output name=dir::$(yarn config get cacheFolder)"
- 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-test:type-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-test:type-
- name: Type Test
run: yarn test:type --cache-dir=".turbo"
test-type-test:
name: Test Type 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 "::set-output name=dir::$(yarn config get cacheFolder)"
- 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-test:test-type-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-test:test-type-
- name: Test Type Test
run: yarn test:test-type --cache-dir=".turbo"
unit-test:
name: Unit 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 "::set-output name=dir::$(yarn config get cacheFolder)"
- 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-test:unit-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-test:unit-
- name: Unit Test
run: yarn test:unit --cache-dir=".turbo"
- name: Collect and upload the coverage report
uses: codecov/codecov-action@v3
#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
# run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov
# - name: Collect and upload the coverage report
# uses: codecov/codecov-action@v3
# with:
# file: ./coverage.lcov
# flags: integration