Files
discordeno/.github/workflows/bot-test.yml
Jonathan Ho e610091f3c ci: seperate test (#2785)
* ci: seperate test

* ci: fix site

* chore(site): remove blog
2023-02-20 15:55:54 -06:00

148 lines
4.6 KiB
YAML

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