diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..81f934d6a --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,98 @@ +name: Build Packages + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: + inputs: + pr_number: + description: 'PR number to build and release' + required: true + type: number + push: + branches: ["main"] + +env: + TANGRAM_CI_DIR: ${{ github.workspace }}/../.tangram-ci-${{ github.event.repository.name }} + TG_EXE: ${{ github.workspace }}/../.tangram-ci-${{ github.event.repository.name }}/bin/tangram + +jobs: + test: + if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' + runs-on: ${{ matrix.runner }} + strategy: + matrix: + include: + - runner: [self-hosted, macOS, ARM64] + enabled: true + - runner: [self-hosted, Linux, X64] + enabled: false + + steps: + - name: Check out packages repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} + + - name: Configure Tangram + run: | + mkdir -p "$TANGRAM_CI_DIR/bin" + cat > "$TANGRAM_CI_DIR/config.json" << 'EOF' + {} + EOF + cat > "$TANGRAM_CI_DIR/bin/tangram" << 'EOF' + #!/bin/sh + exec tangram --directory "$TANGRAM_CI_DIR" --config "$TANGRAM_CI_DIR/config.json" "$@" + EOF + chmod +x "$TANGRAM_CI_DIR/bin/tangram" + + - name: Test packages + if: matrix.enabled + shell: bash + run: | + "$TG_EXE" server start + while [ "$("$TG_EXE" server status)" != "started" ]; do + sleep 1 + done + bun run auto --test --sequential + "$TG_EXE" server stop + + release: + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') + runs-on: ${{ matrix.runner }} + strategy: + matrix: + include: + - runner: [self-hosted, macOS, ARM64] + enabled: true + - runner: [self-hosted, Linux, X64] + enabled: false + + steps: + - name: Check out packages repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} + + - name: Configure Tangram + run: | + mkdir -p "$TANGRAM_CI_DIR/bin" + cat > "$TANGRAM_CI_DIR/config.json" << 'EOF' + {} + EOF + cat > "$TANGRAM_CI_DIR/bin/tangram" << 'EOF' + #!/bin/sh + exec tangram --directory "$TANGRAM_CI_DIR" --config "$TANGRAM_CI_DIR/config.json" "$@" + EOF + chmod +x "$TANGRAM_CI_DIR/bin/tangram" + + - name: Release packages + if: matrix.enabled + shell: bash + run: | + "$TG_EXE" server start + while [ "$("$TG_EXE" server status)" != "started" ]; do + sleep 1 + done + bun run auto --release --sequential + "$TG_EXE" server stop diff --git a/.gitignore b/.gitignore index c291c9fde..e1ddf8b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules tangram.lock target +Claude.md