This repository was archived by the owner on May 9, 2025. It is now read-only.
feat: add GitHub Workflow to test using create-solana-dapp #3
This file contains hidden or 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: Test Templates | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [ 18, 20, 22 ] | |
pm: [ npm, pnpm, yarn ] | |
template: [ react-vite-tailwind ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure Git identity | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "CI Bot" | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- 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" | |
BRANCH=${GITHUB_REF#refs/heads/} | |
case ${{ matrix.pm }} in | |
npm) npx create-solana-dapp@latest --template gh:solana-developers/template-${{ matrix.template }}#${BRANCH} test-${{ matrix.template }} ;; | |
pnpm) pnpx create-solana-dapp@latest --template gh:solana-developers/template-${{ matrix.template }}#${BRANCH} test-${{ matrix.template }} ;; | |
yarn) yarn create solana-dapp --template gh:solana-developers/template-${{ matrix.template }}#${BRANCH} test-${{ matrix.template }} ;; | |
esac | |
cd test-${{ matrix.template }} | |
${{ matrix.pm }} install | |
${{ matrix.pm }} run build |