Skip to content

chore(deps): bump rustls-webpki from 0.103.8 to 0.103.10 in /kit/nextjs-anchor/anchor #961

chore(deps): bump rustls-webpki from 0.103.8 to 0.103.10 in /kit/nextjs-anchor/anchor

chore(deps): bump rustls-webpki from 0.103.8 to 0.103.10 in /kit/nextjs-anchor/anchor #961

name: Test Templates
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *' # Daily at midnight UTC
permissions:
contents: read
jobs:
setup-templates:
runs-on: ubuntu-latest
outputs:
templates: ${{ steps.set-matrix.outputs.templates }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
if: github.event_name == 'pull_request'
shell: bash
run: |
# Get changed files in the PR
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
echo "Changed files:"
echo "$CHANGED_FILES"
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- id: set-matrix
shell: bash
run: |
ALL_TEMPLATES=$(cat .github/workflows/templates.json)
# Filter out community templates - they are maintained externally
TESTABLE_TEMPLATES=$(echo $ALL_TEMPLATES | jq -c '[.[] | select(startswith("community/") | not)]')
# For scheduled runs or pushes to main, test all templates (except community)
if [[ "${{ github.event_name }}" == "schedule" ]] || [[ "${{ github.event_name }}" == "push" ]]; then
echo "Running all templates except community (scheduled or push to main)"
echo templates=$(echo $TESTABLE_TEMPLATES | sed 's/ //g') | tee --append $GITHUB_OUTPUT
exit 0
fi
# For PRs, filter templates based on changed files
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
CHANGED_FILES="${{ steps.changed-files.outputs.changed_files }}"
# Check if test-related workflow or action files changed - if so, test all templates (except community)
if echo "$CHANGED_FILES" | grep -q -E '^\.github/workflows/(test-templates\.yml|actions/)'; then
echo "Test workflow or actions changed, testing all templates except community"
echo templates=$(echo $TESTABLE_TEMPLATES | sed 's/ //g') | tee --append $GITHUB_OUTPUT
exit 0
fi
# Extract template paths from changed files (excluding community)
AFFECTED_TEMPLATES=$(echo "$CHANGED_FILES" | grep -E '^(kit|mobile|pinocchio|web3js)/' | cut -d'/' -f1-2 | sort -u || true)
if [[ -z "$AFFECTED_TEMPLATES" ]]; then
echo "No template files changed, skipping template tests"
echo 'templates=[]' | tee --append $GITHUB_OUTPUT
exit 0
fi
echo "Affected templates:"
echo "$AFFECTED_TEMPLATES"
# Filter the templates.json to only include affected templates (excluding community)
FILTERED_TEMPLATES=$(echo "$TESTABLE_TEMPLATES" | jq -c --arg templates "$AFFECTED_TEMPLATES" '
[.[] | select(. as $item | ($templates | split("\n") | map(. == $item) | any))]
')
echo "Filtered templates: $FILTERED_TEMPLATES"
echo templates=$(echo $FILTERED_TEMPLATES | sed 's/ //g') | tee --append $GITHUB_OUTPUT
fi
test-npm:
name: Test (npm)
runs-on: ubuntu-latest
needs: [setup-templates]
if: needs.setup-templates.outputs.templates != '[]'
strategy:
fail-fast: false
matrix:
node: [20, 22]
template: ${{ fromJson(needs.setup-templates.outputs.templates) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create and Build using create-solana-dapp
uses: ./.github/workflows/actions/create-solana-dapp
with:
cmd: 'npx -y create-solana-dapp@latest'
node-version: ${{ matrix.node }}
package-manager: 'npm'
template: ${{ matrix.template }}
test-pnpm:
name: Test (pnpm)
runs-on: ubuntu-latest
needs: [setup-templates]
if: needs.setup-templates.outputs.templates != '[]'
strategy:
fail-fast: false
matrix:
node: [20, 22]
template: ${{ fromJson(needs.setup-templates.outputs.templates) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create and Build using create-solana-dapp
uses: ./.github/workflows/actions/create-solana-dapp
with:
cmd: 'pnpm create solana-dapp@latest'
node-version: ${{ matrix.node }}
package-manager: 'pnpm'
template: ${{ matrix.template }}
test-yarn:
name: Test (yarn)
runs-on: ubuntu-latest
needs: [setup-templates]
if: needs.setup-templates.outputs.templates != '[]'
strategy:
fail-fast: false
matrix:
node: [20, 22]
template: ${{ fromJson(needs.setup-templates.outputs.templates) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create and Build using create-solana-dapp
uses: ./.github/workflows/actions/create-solana-dapp
with:
cmd: 'yarn create solana-dapp'
node-version: ${{ matrix.node }}
package-manager: 'yarn'
template: ${{ matrix.template }}