-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from hyperweb-io/feat/workflows
Add testing workflows
- Loading branch information
Showing
2 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Build templates | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get examples from directories | ||
id: get-matrix | ||
env: | ||
DIRS: '["templates"]' # Add more dirs here if needed | ||
run: | | ||
# Get examples from each directory | ||
all_examples=$(for dir in $(echo $DIRS | jq -r '.[]'); do | ||
for example in $(ls ./$dir/); do | ||
echo "{\"example\": \"$example\", \"path\": \"$dir\"}" | ||
done | ||
done | jq -s -c '.') | ||
echo "matrix=$all_examples" >> $GITHUB_OUTPUT | ||
outputs: | ||
matrix: ${{ steps.get-matrix.outputs.matrix }} | ||
|
||
build: | ||
needs: [setup] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
fail-fast: true | ||
matrix: | ||
include: ${{fromJson(needs.setup.outputs.matrix)}} | ||
env: | ||
EXAMPLE_DIR: ${{ github.workspace }}/dest/${{ matrix.example }} | ||
YARN_ENABLE_IMMUTABLE_INSTALLS: false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Set up Yarn | ||
uses: threeal/[email protected] | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
${{ env.EXAMPLE_DIR }}/node_modules | ||
key: ${{ runner.os }}-modules-${{ matrix.example }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-modules-${{ matrix.example }}- | ||
- name: Cache NextJS | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
${{ env.EXAMPLE_DIR }}/.next/cache | ||
key: ${{ runner.os }}-nextjs-${{ matrix.example }}-${{ hashFiles( | ||
'${{ env.EXAMPLE_DIR }}/**/*.{js,jsx,ts,tsx}', | ||
'!${{ env.EXAMPLE_DIR }}/node_modules/**', | ||
'!${{ env.EXAMPLE_DIR }}/.next/**', | ||
'!${{ env.EXAMPLE_DIR }}/.yarn/**' | ||
) }} | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ matrix.example }}- | ||
- name: Build example | ||
run: | | ||
echo "Building example: ${{ matrix.example }} from /${{ matrix.path }}" | ||
mkdir -p ${{ env.EXAMPLE_DIR }} | ||
cp -r ./${{ matrix.path }}/${{ matrix.example }}/* ${{ env.EXAMPLE_DIR }}/ | ||
cd ${{ env.EXAMPLE_DIR }} | ||
ls -la | ||
yarn install | ||
yarn build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Run Tests Prod | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Set up Yarn | ||
uses: threeal/[email protected] | ||
with: | ||
cache: false | ||
|
||
- name: Install Dependencies | ||
run: | | ||
echo "YARN_ENABLE_IMMUTABLE_INSTALLS=false" >> $GITHUB_ENV | ||
npm install -g create-hyperweb-app | ||
- name: hyperweb | ||
run: | | ||
cha --template hyperweb --name hyperweb | ||
cd hyperweb | ||
yarn build | ||
- name: chain-admin | ||
run: | | ||
cha --template chain-admin --name chain-admin | ||
cd chain-admin | ||
yarn build |