Skip to content

Test Templates

Test Templates #307

Workflow file for this run

name: Test Templates
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
schedule:
- cron: '20 4 * * *'
workflow_dispatch:
jobs:
setup-templates:
runs-on: ubuntu-latest
outputs:
templates: ${{ steps.set-matrix.outputs.templates }}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
uses: ./.github/workflows/actions/install-dependencies
with:
version: 'current'
- name: Build
run: pnpm build
- id: set-matrix
shell: bash
run: |
echo "templates=$(${{ github.workspace }}/dist/bin/index.cjs --list-template-ids | tr -d '[:space:]')" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: [setup-templates]
strategy:
matrix:
node: [20, 22]
pm: [npm, pnpm, yarn]
template: ${{ fromJson(needs.setup-templates.outputs.templates) }}
steps:
- name: Setup Anchor
uses: metadaoproject/[email protected]
with:
anchor-version: '0.30.1'
solana-cli-version: '2.0.21'
node-version: ${{ matrix.node }}
- name: Configure Git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI Bot"
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm build
- name: Install package manager (if needed)
run: |
case ${{ matrix.pm }} in
npm) echo "Using npm";;
pnpm) npm install -g pnpm;;
yarn) npm install -g yarn;;
esac
- name: Create and Build using create-solana-dapp
run: |
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
CLI_PATH="${{ github.workspace }}/dist/bin/index.cjs"
case ${{ matrix.pm }} in
npm) node "$CLI_PATH" --template ${{ matrix.template }} sandbox ;;
pnpm) node "$CLI_PATH" --template ${{ matrix.template }} sandbox --pnpm ;;
yarn) node "$CLI_PATH" --template ${{ matrix.template }} sandbox --yarn ;;
esac
cd sandbox
${{ matrix.pm }} install
${{ matrix.pm }} run build