[core] clean up exports #716
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 | |
| on: | |
| push: | |
| paths-ignore: &ci_ignore_paths | |
| - ".zed/**" | |
| - ".vscode/**" | |
| - "README.md" | |
| # Formatters | |
| - ".editorconfig" | |
| - "eslint.config.json" | |
| - "prettier.config.json" | |
| pull_request: | |
| paths-ignore: *ci_ignore_paths | |
| workflow_dispatch: | |
| env: | |
| WASM_BINDGEN_VERSION: "0.2.105" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| version-check: | |
| name: Check Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| scramjet_version_changed: ${{ steps.check-scramjet.outputs.version_changed }} | |
| scramjet_new_version: ${{ steps.check-scramjet.outputs.new_version }} | |
| scramjet_tag_arg: ${{ steps.check-scramjet.outputs.tag_arg }} | |
| controller_version_changed: ${{ steps.check-scramjet-controller.outputs.version_changed }} | |
| controller_new_version: ${{ steps.check-scramjet-controller.outputs.new_version }} | |
| controller_tag_arg: ${{ steps.check-scramjet-controller.outputs.tag_arg }} | |
| utils_version_changed: ${{ steps.check-scramjet-utils.outputs.version_changed }} | |
| utils_new_version: ${{ steps.check-scramjet-utils.outputs.new_version }} | |
| utils_tag_arg: ${{ steps.check-scramjet-utils.outputs.tag_arg }} | |
| bootstrap_version_changed: ${{ steps.check-bootstrap.outputs.version_changed }} | |
| bootstrap_new_version: ${{ steps.check-bootstrap.outputs.new_version }} | |
| bootstrap_tag_arg: ${{ steps.check-bootstrap.outputs.tag_arg }} | |
| create_proxy_app_version_changed: ${{ steps.check-create-proxy-app.outputs.version_changed }} | |
| create_proxy_app_new_version: ${{ steps.check-create-proxy-app.outputs.new_version }} | |
| create_proxy_app_tag_arg: ${{ steps.check-create-proxy-app.outputs.tag_arg }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Check the version (scramjet/core) | |
| id: check-scramjet | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version packages/core/package.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| LATEST_VERSION=$(npm view @mercuryworkshop/scramjet versions --json | jq -r '.[-1]' || echo "0.0.0") | |
| echo "Latest NPM version: $LATEST_VERSION" | |
| if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | |
| then | |
| echo "Version changed" | |
| echo "version_changed=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| TAG_ARG="" | |
| if [[ "$CURRENT_VERSION" == *-* ]]; then PRE="${CURRENT_VERSION#*-}"; TAG_ARG="--tag ${PRE%%[.+]*}"; fi | |
| echo "tag_arg=$TAG_ARG" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version not changed" | |
| echo "version_changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check the version (scramjet/controller) | |
| id: check-scramjet-controller | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version packages/controller/package.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| LATEST_VERSION=$(npm view @mercuryworkshop/scramjet-controller versions --json | jq -r '.[-1]' || echo "0.0.0") | |
| echo "Latest NPM version: $LATEST_VERSION" | |
| if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | |
| then | |
| echo "Version changed" | |
| echo "version_changed=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| TAG_ARG="" | |
| if [[ "$CURRENT_VERSION" == *-* ]]; then PRE="${CURRENT_VERSION#*-}"; TAG_ARG="--tag ${PRE%%[.+]*}"; fi | |
| echo "tag_arg=$TAG_ARG" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version not changed" | |
| echo "version_changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check the version (scramjet/utils) | |
| id: check-scramjet-utils | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version packages/utils/package.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| LATEST_VERSION=$(npm view @mercuryworkshop/scramjet-utils versions --json | jq -r '.[-1]' || echo "0.0.0") | |
| echo "Latest NPM version: $LATEST_VERSION" | |
| if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | |
| then | |
| echo "Version changed" | |
| echo "version_changed=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| TAG_ARG="" | |
| if [[ "$CURRENT_VERSION" == *-* ]]; then PRE="${CURRENT_VERSION#*-}"; TAG_ARG="--tag ${PRE%%[.+]*}"; fi | |
| echo "tag_arg=$TAG_ARG" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version not changed" | |
| echo "version_changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check the version (proxy-bootstrap) | |
| id: check-bootstrap | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version packages/bootstrap/package.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| LATEST_VERSION=$(npm view @mercuryworkshop/proxy-bootstrap versions --json | jq -r '.[-1]' || echo "0.0.0") | |
| echo "Latest NPM version: $LATEST_VERSION" | |
| if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | |
| then | |
| echo "Version changed" | |
| echo "version_changed=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| TAG_ARG="" | |
| if [[ "$CURRENT_VERSION" == *-* ]]; then PRE="${CURRENT_VERSION#*-}"; TAG_ARG="--tag ${PRE%%[.+]*}"; fi | |
| echo "tag_arg=$TAG_ARG" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version not changed" | |
| echo "version_changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check the version (create-proxy-app) | |
| id: check-create-proxy-app | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version packages/create-proxy-app/package.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| LATEST_VERSION=$(npm view create-proxy-app versions --json | jq -r '.[-1]' || echo "0.0.0") | |
| echo "Latest NPM version: $LATEST_VERSION" | |
| if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | |
| then | |
| echo "Version changed" | |
| echo "version_changed=true" >> "$GITHUB_OUTPUT" | |
| echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| TAG_ARG="" | |
| if [[ "$CURRENT_VERSION" == *-* ]]; then PRE="${CURRENT_VERSION#*-}"; TAG_ARG="--tag ${PRE%%[.+]*}"; fi | |
| echo "tag_arg=$TAG_ARG" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Version not changed" | |
| echo "version_changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| build: | |
| name: Build Scramjet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "pnpm" | |
| - name: Install pnpm dependencies | |
| run: pnpm install | |
| - name: Setup Rewriter Toolchain | |
| uses: ./.github/actions/setup-rewriter-toolchain | |
| with: | |
| wasm-bindgen-version: ${{ env.WASM_BINDGEN_VERSION }} | |
| rewriter-path: packages/core/rewriter | |
| github-token: ${{ github.token }} | |
| - name: Pack Scramjet | |
| run: pnpm pack | |
| working-directory: packages/core | |
| - name: Pack Scramjet Controller | |
| run: pnpm pack | |
| working-directory: packages/controller | |
| - name: Pack Scramjet Utils | |
| run: pnpm pack | |
| working-directory: packages/utils | |
| - name: Pack Proxy Bootstrap | |
| run: pnpm pack | |
| working-directory: packages/bootstrap | |
| - name: Pack create-proxy-app | |
| run: pnpm pack | |
| working-directory: packages/create-proxy-app | |
| - name: Upload Artifact (scramjet/core) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet | |
| path: packages/core/dist/* | |
| - name: Upload Artifact (scramjet/core) (packaged) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet-package | |
| path: packages/core/mercuryworkshop-scramjet-*.tgz | |
| - name: Upload Artifact (scramjet/controller) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet-controller | |
| path: packages/controller/dist/* | |
| - name: Upload Artifact (scramjet/controller) (packaged) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet-controller-package | |
| path: packages/controller/mercuryworkshop-scramjet-controller-*.tgz | |
| - name: Upload Artifact (scramjet/utils) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet-utils | |
| path: packages/utils/dist/* | |
| - name: Upload Artifact (scramjet/utils) (packaged) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scramjet-utils-package | |
| path: packages/utils/mercuryworkshop-scramjet-utils-*.tgz | |
| - name: Upload Artifact (proxy-bootstrap) (packaged) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: proxy-bootstrap-package | |
| path: packages/bootstrap/mercuryworkshop-proxy-bootstrap-*.tgz | |
| - name: Upload Artifact (create-proxy-app) (packaged) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: create-proxy-app-package | |
| path: packages/create-proxy-app/create-proxy-app-*.tgz | |
| package-validation: | |
| name: Validate Package Structure | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Get artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-package | |
| path: packages/core | |
| - name: Extract package | |
| run: tar xvf mercuryworkshop-scramjet-*.tgz package --strip-components=1 | |
| working-directory: packages/core | |
| - name: Run package validation tests | |
| run: pnpm test:package | |
| tests: | |
| name: Run Scramjet Tests | |
| runs-on: ubuntu-latest | |
| needs: [build, package-validation] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Get artifacts (scramjet/core) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet | |
| path: packages/core/dist | |
| - name: Get artifacts (scramjet/controller) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-controller | |
| path: packages/controller/dist | |
| - name: Install Playwright Chromium | |
| run: npx playwright install --with-deps chromium | |
| working-directory: packages/runway | |
| - name: Run Runway tests | |
| run: OMIT_WPT=1 pnpm test --parallel 4 | |
| working-directory: packages/runway | |
| rewritertests: | |
| name: Run Rewriter Tests | |
| runs-on: ubuntu-latest | |
| needs: [build, package-validation] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Cache Rust compilation | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "packages/core/rewriter -> target" | |
| cache-all-crates: true | |
| shared-key: "rewriter" | |
| - name: Run Tests | |
| run: cd packages/core/rewriter/native && cargo test | |
| upload: | |
| name: Upload release | |
| runs-on: ubuntu-latest | |
| needs: [version-check, build, package-validation, tests, rewritertests] | |
| permissions: write-all | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Delete old release and tag | |
| uses: dev-drprasad/delete-tag-and-release@v1.1 | |
| with: | |
| delete_release: true | |
| tag_name: latest | |
| github_token: ${{ github.token }} | |
| - name: Get artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-package | |
| path: . | |
| - name: Get artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-controller-package | |
| path: . | |
| - name: Release unstable build to GitHub | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: Continuous Build | |
| tag: latest | |
| commit: main | |
| body: "${{ github.event.head_commit.url }} ${{ github.event.head_commit.message }}" | |
| artifacts: "mercuryworkshop-scramjet-*.tgz,mercuryworkshop-scramjet-controller-*.tgz" | |
| prerelease: true | |
| - name: Release tagged version to GitHub (scramjet/core) | |
| if: needs.version-check.outputs.scramjet_version_changed == 'true' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: "${{ needs.version-check.outputs.scramjet_new_version }}" | |
| tag: "v${{ needs.version-check.outputs.scramjet_new_version }}" | |
| commit: main | |
| body: "${{ github.event.head_commit.url }} ${{ github.event.head_commit.message }}" | |
| artifacts: "mercuryworkshop-scramjet-*.tgz" | |
| - name: Release tagged version to GitHub (scramjet/controller) | |
| if: needs.version-check.outputs.controller_version_changed == 'true' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: "${{ needs.version-check.outputs.controller_new_version }}-controller" | |
| tag: "v${{ needs.version-check.outputs.controller_new_version }}-controller" | |
| commit: main | |
| body: "${{ github.event.head_commit.url }} ${{ github.event.head_commit.message }}" | |
| artifacts: "mercuryworkshop-scramjet-controller-*.tgz" | |
| makeLatest: false | |
| publish: | |
| name: Publish Scramjet to NPM | |
| runs-on: ubuntu-latest | |
| needs: [version-check, build, package-validation, tests, rewritertests] | |
| permissions: write-all | |
| if: ${{ (github.ref == 'refs/heads/main') && (needs.version-check.outputs.scramjet_version_changed == 'true' || needs.version-check.outputs.controller_version_changed == 'true' || needs.version-check.outputs.bootstrap_version_changed == 'true' || needs.version-check.outputs.create_proxy_app_version_changed == 'true' || needs.version-check.outputs.utils_version_changed == 'true') }} | |
| steps: | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Get artifacts (scramjet/core) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-package | |
| path: . | |
| - name: Get artifacts (scramjet/controller) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-controller-package | |
| path: . | |
| - name: Get artifacts (scramjet/utils) | |
| if: needs.version-check.outputs.utils_version_changed == 'true' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-utils-package | |
| path: . | |
| - name: Get artifacts (proxy-bootstrap) | |
| if: needs.version-check.outputs.bootstrap_version_changed == 'true' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: proxy-bootstrap-package | |
| path: . | |
| - name: Get artifacts (create-proxy-app) | |
| if: needs.version-check.outputs.create_proxy_app_version_changed == 'true' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: create-proxy-app-package | |
| path: . | |
| - name: Publish Scramjet | |
| if: needs.version-check.outputs.scramjet_version_changed == 'true' | |
| run: pnpm publish mercuryworkshop-scramjet-${{ needs.version-check.outputs.scramjet_new_version }}.tgz --access public --provenance ${{ needs.version-check.outputs.scramjet_tag_arg }} | |
| - name: Publish Scramjet Controller | |
| if: needs.version-check.outputs.controller_version_changed == 'true' | |
| run: pnpm publish mercuryworkshop-scramjet-controller-${{ needs.version-check.outputs.controller_new_version }}.tgz --access public --provenance ${{ needs.version-check.outputs.controller_tag_arg }} | |
| - name: Publish Scramjet Utils | |
| if: needs.version-check.outputs.utils_version_changed == 'true' | |
| run: pnpm publish mercuryworkshop-scramjet-utils-${{ needs.version-check.outputs.utils_new_version }}.tgz --access public --provenance ${{ needs.version-check.outputs.utils_tag_arg }} | |
| - name: Publish Proxy Bootstrap | |
| if: needs.version-check.outputs.bootstrap_version_changed == 'true' | |
| run: pnpm publish mercuryworkshop-proxy-bootstrap-${{ needs.version-check.outputs.bootstrap_new_version }}.tgz --access public --provenance ${{ needs.version-check.outputs.bootstrap_tag_arg }} | |
| - name: Publish create-proxy-app | |
| if: needs.version-check.outputs.create_proxy_app_version_changed == 'true' | |
| run: pnpm publish create-proxy-app-${{ needs.version-check.outputs.create_proxy_app_new_version }}.tgz --access public --provenance ${{ needs.version-check.outputs.create_proxy_app_tag_arg }} | |
| frontend: | |
| name: Build Frontend | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| needs: [build, package-validation] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Get artifacts (scramjet/core) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet | |
| path: packages/core/dist | |
| - name: Get artifacts (scramjet/controller) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-controller | |
| path: packages/controller/dist | |
| - name: Get artifacts (scramjet/utils) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scramjet-utils | |
| path: packages/utils/dist | |
| - name: Build Frontend | |
| run: VITE_WISP_URL="wss://anura.pro/" pnpm build | |
| working-directory: packages/demo | |
| - name: Upload Artifact (frontend) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend | |
| path: ./packages/demo/dist | |
| pages: | |
| name: Upload to Github Pages | |
| runs-on: ubuntu-latest | |
| needs: [frontend, tests, rewritertests] | |
| permissions: write-all | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Get artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: frontend | |
| path: . | |
| - name: Upload pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| - name: Deploy to github | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |