feat(automation): add test and publish jobs #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: Build Packages | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| test: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ${{ matrix.runner }} | |
| environment: test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: [self-hosted, macOS, ARM64] | |
| enabled: true | |
| - runner: [self-hosted, Linux, X64] | |
| enabled: true | |
| steps: | |
| - name: Check out packages repository | |
| uses: actions/checkout@v4 | |
| - name: Set environment variables | |
| run: | | |
| echo "TANGRAM_CI_DIR=$HOME/.tangram-ci" >> $GITHUB_ENV | |
| echo "TG_EXE=$HOME/.tangram-ci/bin/tangram" >> $GITHUB_ENV | |
| - name: Configure Tangram | |
| run: | | |
| mkdir -p "$TANGRAM_CI_DIR/bin" | |
| cat > "$TANGRAM_CI_DIR/config.json" << 'EOF' | |
| { | |
| "remotes": [] | |
| } | |
| EOF | |
| cat > "$TANGRAM_CI_DIR/bin/tangram" << 'EOF' | |
| #!/bin/sh | |
| exec tangram --directory "$TANGRAM_CI_DIR/.tangram" --config "$TANGRAM_CI_DIR/config.json" "$@" | |
| EOF | |
| chmod +x "$TANGRAM_CI_DIR/bin/tangram" | |
| - name: Test packages | |
| if: matrix.enabled | |
| shell: bash | |
| run: | | |
| bun run auto --test --sequential | |
| release: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ${{ matrix.runner }} | |
| environment: release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: [self-hosted, macOS, ARM64] | |
| enabled: true | |
| - runner: [self-hosted, Linux, X64] | |
| enabled: true | |
| steps: | |
| - name: Check out packages repository | |
| uses: actions/checkout@v4 | |
| - name: Set environment variables | |
| run: | | |
| echo "TANGRAM_CI_DIR=$HOME/.tangram-ci" >> $GITHUB_ENV | |
| echo "TG_EXE=$HOME/.tangram-ci/bin/tangram" >> $GITHUB_ENV | |
| - name: Configure Tangram | |
| run: | | |
| mkdir -p "$TANGRAM_CI_DIR/bin" | |
| cat > "$TANGRAM_CI_DIR/config.json" << 'EOF' | |
| { | |
| "remotes": [] | |
| } | |
| EOF | |
| cat > "$TANGRAM_CI_DIR/bin/tangram" << 'EOF' | |
| #!/bin/sh | |
| exec tangram --directory "$TANGRAM_CI_DIR/.tangram" --config "$TANGRAM_CI_DIR/config.json" "$@" | |
| EOF | |
| chmod +x "$TANGRAM_CI_DIR/bin/tangram" | |
| - name: Release packages | |
| if: matrix.enabled | |
| shell: bash | |
| run: | | |
| bun run auto --release --sequential |