updated bot.ts CLI & compatibility files #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Factory Tests | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
node: | |
if: github.repository == 'bot-ts/framework' | |
name: Test on Node.js v22 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package-manager: [npm, yarn, pnpm] | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22 | |
- name: Install package manager | |
run: | | |
if [ "${{ matrix.package-manager }}" != "npm" ]; then | |
if [ "${{ matrix.package-manager }}" == "yarn" ]; then | |
npm install -g yarn@latest # or @berry for advanced features | |
else | |
npm install -g ${{ matrix.package-manager }}@latest | |
fi | |
else | |
echo "npm is already installed" | |
fi | |
- name: Copy lockfile | |
run: | | |
rm -f bun.lockb | |
if [ "${{ matrix.package-manager }}" == "npm" ]; then | |
cp lockfiles/package-lock.json ./ | |
elif [ "${{ matrix.package-manager }}" == "yarn" ]; then | |
cp lockfiles/yarn.lock ./ | |
elif [ "${{ matrix.package-manager }}" == "pnpm" ]; then | |
cp lockfiles/pnpm-lock.yaml ./ | |
fi | |
- name: Install dependencies | |
run: | | |
if [ "${{ matrix.package-manager }}" == "npm" ]; then | |
npm ci | |
npm install @rollup/rollup-linux-x64-gnu | |
elif [ "${{ matrix.package-manager }}" == "yarn" ]; then | |
yarn install --frozen-lockfile | |
yarn add @rollup/rollup-linux-x64-gnu | |
elif [ "${{ matrix.package-manager }}" == "pnpm" ]; then | |
pnpm install --frozen-lockfile | |
pnpm add @rollup/rollup-linux-x64-gnu | |
fi | |
- name: Check typings | |
run: npx tsc --noEmit | |
- name: Build JS | |
run: npx rimraf dist && npx rollup -c && node scripts/copy-keepers.js | |
- name: Rebuild sqlite3 | |
run: | | |
if [ "${{ matrix.package-manager }}" == "yarn" ]; then | |
npm rebuild sqlite3 # yarn doesn't have a rebuild command (but with @berry version) | |
else | |
${{ matrix.package-manager }} rebuild sqlite3 | |
fi | |
- name: Start the bot | |
run: node dist/index.test.js | |
bun: | |
name: Test on Bun v1.1.34 | |
needs: node | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: 1.1.34 | |
- name: Install dependencies | |
run: bun install | |
- name: Start the bot | |
env: | |
BOT_MODE: test | |
run: bun run src/index.test.ts | |
deno: | |
name: Test on Deno v2.0.6 | |
needs: node | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Deno | |
uses: denolib/setup-deno@v2 | |
with: | |
deno-version: 2.0.6 | |
- name: Install dependencies | |
run: deno install --allow-scripts | |
- name: Start the bot | |
env: | |
BOT_MODE: test | |
run: deno -A src/index.test.ts |