Merge pull request #2054 from dyoshikawa/resolve-scrap-issue-2051-goo… #2868
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: E2E Tests on Cross-Platform | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: &paths-ignore | |
| - "**/*.md" | |
| - "images/**" | |
| - ".devcontainer/**" | |
| - ".vscode/**" | |
| - ".zed/**" | |
| - "LICENSE" | |
| - "cspell.json" | |
| - ".cspellcache" | |
| - ".secretlintrc.json" | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: *paths-ignore | |
| permissions: | |
| contents: read # Required for checking out code | |
| jobs: | |
| build: | |
| name: Build binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup mise | |
| uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v2 | |
| with: | |
| experimental: true | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build binaries | |
| run: | | |
| mkdir -p dist-bun | |
| bun build --compile --minify --sourcemap --target=bun-linux-x64 --outfile=dist-bun/rulesync-linux-x64 ./src/cli/index.ts | |
| bun build --compile --minify --sourcemap --target=bun-linux-arm64 --outfile=dist-bun/rulesync-linux-arm64 ./src/cli/index.ts | |
| bun build --compile --minify --sourcemap --target=bun-darwin-arm64 --outfile=dist-bun/rulesync-darwin-arm64 ./src/cli/index.ts | |
| bun build --compile --minify --sourcemap --target=bun-darwin-x64 --outfile=dist-bun/rulesync-darwin-x64 ./src/cli/index.ts | |
| bun build --compile --minify --sourcemap --target=bun-windows-x64 --outfile=dist-bun/rulesync-windows-x64.exe ./src/cli/index.ts | |
| - name: Cache binaries | |
| uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: dist-bun | |
| key: rulesync-binaries-${{ github.sha }} | |
| enableCrossOsArchive: true | |
| e2e: | |
| name: E2E Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| needs: build | |
| strategy: | |
| # Keep every platform leg running even if one fails, so a single | |
| # platform-specific breakage does not mask the others' results. | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Restore cached binaries | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: dist-bun | |
| key: rulesync-binaries-${{ github.sha }} | |
| enableCrossOsArchive: true | |
| fail-on-cache-miss: true | |
| - name: Make binary executable (Unix) | |
| if: runner.os != 'Windows' | |
| env: | |
| MATRIX_OS: ${{ matrix.os }} | |
| run: | | |
| if [ "$MATRIX_OS" = "ubuntu-latest" ]; then | |
| chmod +x dist-bun/rulesync-linux-x64 | |
| BINARY_PATH=dist-bun/rulesync-linux-x64 | |
| elif [ "$MATRIX_OS" = "macos-latest" ]; then | |
| # macos-latest is Apple Silicon (arm64) | |
| chmod +x dist-bun/rulesync-darwin-arm64 | |
| BINARY_PATH=dist-bun/rulesync-darwin-arm64 | |
| else | |
| echo "Unexpected matrix OS for Unix binary selection: $MATRIX_OS" >&2 | |
| exit 1 | |
| fi | |
| echo "BINARY_PATH=$BINARY_PATH" >> "$GITHUB_ENV" | |
| - name: Set binary path (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| echo "BINARY_PATH=dist-bun/rulesync-windows-x64.exe" >> "$GITHUB_ENV" | |
| - name: Setup mise | |
| uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v2 | |
| with: | |
| experimental: true | |
| - name: Install dependencies | |
| run: pnpm install --ignore-scripts | |
| - name: Test binary | |
| env: | |
| RULESYNC_CMD: ${{ env.BINARY_PATH }} | |
| run: pnpm test:e2e |