Merge pull request #1429 from tmchow/refactor/1076-api-code-quality #1936
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@1648a7812b9aeae629881980618f079932869151 # 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@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: dist-bun | |
| key: rulesync-binaries-${{ github.sha }} | |
| enableCrossOsArchive: true | |
| e2e: | |
| name: E2E Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| needs: build | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, macos-15-intel, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Restore cached binaries | |
| uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| 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 | |
| # macos-15-intel is Intel (x64) | |
| chmod +x dist-bun/rulesync-darwin-x64 | |
| BINARY_PATH=dist-bun/rulesync-darwin-x64 | |
| 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@1648a7812b9aeae629881980618f079932869151 # 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 |