chore: serena #10
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: CI/CD | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main, master, develop, hotfix/*] | |
| workflow_dispatch: | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pages: write | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=4000 | |
| DETECT_CHROMEDRIVER_VERSION: "true" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| defaults: | |
| run: | |
| working-directory: gui/smalruby3-editor | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| cache: "npm" | |
| cache-dependency-path: gui/smalruby3-editor/package-lock.json | |
| node-version-file: "gui/smalruby3-editor/.nvmrc" | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Create Test Results Directory | |
| run: | | |
| mkdir -p packages/scratch-gui/test-results | |
| mkdir -p packages/scratch-vm/test-results | |
| - name: Lint | |
| run: npm run lint | |
| - name: Unit tests | |
| run: | | |
| npm run test:unit:gui -- --reporters="default" --reporters="jest-junit" | |
| npm run test:unit:vm -- -R junit > packages/scratch-vm/test-results/unit.xml | |
| - name: Store Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-unit | |
| path: | | |
| gui/smalruby3-editor/packages/scratch-gui/test-results | |
| gui/smalruby3-editor/packages/scratch-vm/test-results | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: gui/smalruby3-editor | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| cache: "npm" | |
| cache-dependency-path: gui/smalruby3-editor/package-lock.json | |
| node-version-file: "gui/smalruby3-editor/.nvmrc" | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Build | |
| env: | |
| GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| MESH_GRAPHQL_ENDPOINT: ${{ secrets.MESH_GRAPHQL_ENDPOINT }} | |
| MESH_API_KEY: ${{ secrets.MESH_API_KEY }} | |
| MESH_AWS_REGION: ${{ secrets.MESH_AWS_REGION }} | |
| run: npm run build | |
| - name: Create Test Results Directory | |
| run: | | |
| mkdir -p packages/scratch-gui/test-results | |
| mkdir -p packages/scratch-vm/test-results | |
| - name: Integration tests | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| npm run test:integration:gui -- --reporters="default" --reporters="jest-junit" | |
| npm run test:integration:vm -- -R junit > packages/scratch-vm/test-results/integration.xml | |
| - name: Store Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-integration | |
| path: | | |
| gui/smalruby3-editor/packages/scratch-gui/test-results | |
| gui/smalruby3-editor/packages/scratch-vm/test-results | |
| - name: Store Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: gui/smalruby3-editor/packages/scratch-gui/build | |
| - name: Prepare deployment files | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') | |
| run: touch packages/scratch-gui/build/.nojekyll | |
| - name: Deploy to smalruby.app | |
| uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3 | |
| if: | | |
| github.event_name == 'push' && | |
| (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') | |
| with: | |
| deploy_key: ${{ secrets.SMALRUBY_APP_DEPLOY_KEY }} | |
| publish_dir: gui/smalruby3-editor/packages/scratch-gui/build | |
| full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}" | |
| cname: smalruby.app | |
| external_repository: smalruby/smalruby.app |