mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-21 12:12:54 +09:00
## Description This PR adds support for templates. - Extracted out the defaults like `.vercelignore` and `image-loader`. As, if the users re using some other service providers they come as default and won't help. - Add prompt for selecting a template at the start of the init process. - Added template for `netlify-functions` and `netlify-edge-functions`. ## Code Review - [ ] hi @istarkov , I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview - [ ] hi @TrySound , I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [x] made a self-review - [x] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [x] tested locally
106 lines
4.5 KiB
YAML
106 lines
4.5 KiB
YAML
name: Cli tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
# cancel in-progress runs on new commits to same PR (gitub.event.number)
|
|
concurrency:
|
|
group: cli-${{ github.workflow }}-${{ github.event.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
jobs:
|
|
checks:
|
|
timeout-minutes: 20
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
env:
|
|
DATABASE_URL: postgres://
|
|
AUTH_SECRET: test
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit
|
|
|
|
- uses: ./.github/actions/ci-setup
|
|
|
|
- name: Build cli
|
|
run: pnpm turbo run build --filter='webstudio-cli'
|
|
|
|
# Testing fixtures for vercel template
|
|
- name: Test cli --help flag
|
|
working-directory: ./fixtures/webstudio-remix-vercel
|
|
run: pnpm webstudio-cli --help
|
|
|
|
- name: Test cli link command for vercel
|
|
working-directory: ./fixtures/webstudio-remix-vercel
|
|
run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/cddc1d44-af37-4cb6-a430-d300cf6f932d?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d'
|
|
|
|
- name: Test cli sync command for vercel
|
|
working-directory: ./fixtures/webstudio-remix-vercel
|
|
run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
|
|
|
|
- name: Test cli build command for vercel
|
|
working-directory: ./fixtures/webstudio-remix-vercel
|
|
run: pnpm webstudio-cli build --preview && pnpm prettier --write ./app/ ./package.json
|
|
|
|
# Testing fixtures for netlify-functions template
|
|
- name: Test cli link command for netlify-functions
|
|
working-directory: ./fixtures/webstudio-remix-netlify-functions
|
|
run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/d845c167-ea07-4875-b08d-83e97c09dcce?authToken=e9d1343f-9298-4fd3-a66e-f89a5af2dd93'
|
|
|
|
- name: Test cli sync command for netlify-functions
|
|
working-directory: ./fixtures/webstudio-remix-netlify-functions
|
|
run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
|
|
|
|
- name: Test cli build command for netlify-functions
|
|
working-directory: ./fixtures/webstudio-remix-netlify-functions
|
|
run: pnpm webstudio-cli build --template netlify-functions --preview && pnpm prettier --write ./app/ ./package.json
|
|
|
|
# Testing fixtures for netlify-edge-functions template
|
|
- name: Test cli link command for netlify-edge-functions
|
|
working-directory: ./fixtures/webstudio-remix-netlify-edge-functions
|
|
run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/d845c167-ea07-4875-b08d-83e97c09dcce?authToken=e9d1343f-9298-4fd3-a66e-f89a5af2dd93&'
|
|
|
|
- name: Test cli sync command for netlify-edge-functions
|
|
working-directory: ./fixtures/webstudio-remix-netlify-edge-functions
|
|
run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
|
|
|
|
- name: Test cli build command for netlify-edge-functions
|
|
working-directory: ./fixtures/webstudio-remix-netlify-edge-functions
|
|
run: pnpm webstudio-cli build --template netlify-edge-functions --preview && pnpm prettier --write ./app/ ./package.json
|
|
|
|
# Testing fixtures for custom template
|
|
- name: Test cli link command for custom template
|
|
working-directory: ./fixtures/webstudio-custom-template
|
|
run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/cddc1d44-af37-4cb6-a430-d300cf6f932d?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d'
|
|
|
|
- name: Test cli sync command for custom template
|
|
working-directory: ./fixtures/webstudio-custom-template
|
|
run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
|
|
|
|
- name: Test cli build command for custom template
|
|
working-directory: ./fixtures/webstudio-custom-template
|
|
run: pnpm webstudio-cli build --template ./custom-template --preview && pnpm prettier --write ./app/ ./package.json
|
|
|
|
- name: Test git diff
|
|
# This command will fail if there are uncommitted changes, i.e something has broken
|
|
run: git diff --name-only HEAD --exit-code
|
|
|
|
- name: Show changed files
|
|
if: ${{ failure() }}
|
|
run: |
|
|
echo "Changed files are:"
|
|
git diff --name-only HEAD
|