-
Notifications
You must be signed in to change notification settings - Fork 8
Use musl targets for static Linux binaries #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
85bd4ba
Fix #107: Use musl targets for static Linux binaries
JasonShin 1ead111
Add comprehensive E2E tests across platforms and Linux distros
JasonShin ace4980
Fix static binary verification for static-pie binaries
JasonShin c7fbb87
add archlinux and nixos in e2e-linux-distros
JasonShin e3edf21
split out compatibility-tests
JasonShin 0ec385f
update
JasonShin 02b3a2a
fix
JasonShin e438463
spelling
JasonShin 46b9be8
simplify node build
JasonShin 844ebbe
rename files
JasonShin 618c17f
rename
JasonShin 748443f
better name
JasonShin ae893e1
rename
JasonShin bfe5edd
cancel prev build
JasonShin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,265 @@ | ||
| name: Compatibility tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| workflow_dispatch: { } | ||
| schedule: | ||
| - cron: "0 0 * * *" # weekly | ||
| workflow_run: | ||
| workflows: ["Release"] | ||
| types: | ||
| - completed | ||
|
|
||
| jobs: | ||
| e2e: | ||
| name: E2E tests with Node.js npm package | ||
| runs-on: ${{ matrix.os }} | ||
| # Skip this job for version bump commits (binary won't exist yet) | ||
| if: "!contains(github.event.head_commit.message, 'Release')" | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| db: | ||
| - mysql: 8 | ||
| - mysql: 5.7 | ||
| - mysql: 5.6 | ||
| - postgres: 16 | ||
| - postgres: 15 | ||
| - postgres: 14 | ||
| - postgres: 13 | ||
| - postgres: 12 | ||
| # Only run database tests on ubuntu-latest to save CI time | ||
| exclude: | ||
| - os: macos-latest | ||
| db: { mysql: 5.7 } | ||
| - os: macos-latest | ||
| db: { mysql: 5.6 } | ||
| - os: macos-latest | ||
| db: { postgres: 15 } | ||
| - os: macos-latest | ||
| db: { postgres: 14 } | ||
| - os: macos-latest | ||
| db: { postgres: 13 } | ||
| - os: macos-latest | ||
| db: { postgres: 12 } | ||
| - os: windows-latest | ||
| db: { mysql: 5.7 } | ||
| - os: windows-latest | ||
| db: { mysql: 5.6 } | ||
| - os: windows-latest | ||
| db: { postgres: 15 } | ||
| - os: windows-latest | ||
| db: { postgres: 14 } | ||
| - os: windows-latest | ||
| db: { postgres: 13 } | ||
| - os: windows-latest | ||
| db: { postgres: 12 } | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node.js 20 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Build docker-compose services for integration tests (Linux only) | ||
| if: runner.os == 'Linux' | ||
| run: docker compose -f docker-compose.yml up -d | ||
| env: | ||
| MYSQL_VERSION: ${{ matrix.db.mysql }} | ||
| PG_VERSION: ${{ matrix.db.postgres }} | ||
| MYSQL_MIGRATION_FILE: "${{ matrix.db.mysql == '5.6' && 'mysql_migration_5_6.sql' || 'mysql_migration.sql' }}" | ||
|
|
||
| - name: Wait for databases to be ready (Linux only) | ||
| if: runner.os == 'Linux' | ||
| uses: GuillaumeFalourd/wait-sleep-action@v1 | ||
| with: | ||
| time: '10' | ||
|
|
||
| - name: Check docker-compose services (Linux only) | ||
| if: runner.os == 'Linux' | ||
| run: docker ps -a | ||
|
|
||
| - name: Install sqlx-ts from npm | ||
| working-directory: ./node | ||
| run: npm install | ||
|
|
||
| - name: Verify sqlx-ts installation | ||
| working-directory: ./node | ||
| shell: bash | ||
| run: | | ||
| ./sqlx-ts --version | ||
| ./sqlx-ts --help | ||
|
|
||
| - name: Create test directory | ||
| shell: bash | ||
| run: mkdir -p tests/staging | ||
|
|
||
| - name: Add failure.ts test file (Linux only) | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| run: | | ||
| cat << 'EOF' > tests/staging/failure.ts | ||
| import { sql } from 'sqlx-ts' | ||
|
|
||
| const selectSql4 = sql` | ||
| SELECT itemz.* | ||
| FROM items; | ||
| ` | ||
| EOF | ||
|
|
||
| - name: Run failure test (Linux only) | ||
| if: runner.os == 'Linux' | ||
| working-directory: ./node | ||
| shell: bash | ||
| run: | | ||
| set +e | ||
| ./sqlx-ts --config=../.sqlxrc.sample.json ../tests/staging | ||
| EXIT_CODE=$? | ||
| if [ $EXIT_CODE -eq 0 ]; then | ||
| echo "Expected failure, but command succeeded." | ||
| exit 1 | ||
| fi | ||
| echo "Command failed as expected with exit code $EXIT_CODE." | ||
|
|
||
| - name: Remove failure test file | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| run: rm -f tests/staging/failure.ts | ||
|
|
||
| - name: Add happy.ts test file (Linux only) | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| run: | | ||
| cat << 'EOF' > tests/staging/happy.ts | ||
| import { sql } from 'sqlx-ts' | ||
|
|
||
| const selectSql4 = sql` | ||
| SELECT items.* | ||
| FROM items; | ||
| ` | ||
| EOF | ||
|
|
||
| - name: Run happy test (Linux only) | ||
| if: runner.os == 'Linux' | ||
| working-directory: ./node | ||
| shell: bash | ||
| run: ./sqlx-ts --config=../.sqlxrc.sample.json ../tests/staging | ||
|
|
||
| - name: Test sqlx-ts on ${{ matrix.os }} (no database) | ||
| if: runner.os != 'Linux' | ||
| working-directory: ./node | ||
| shell: bash | ||
| run: | | ||
| echo "✅ sqlx-ts successfully installed and runs on ${{ matrix.os }}" | ||
| ./sqlx-ts --version | ||
| ./sqlx-ts --help | ||
|
|
||
|
|
||
| e2e-linux-distros: | ||
| name: E2E npm package on Linux distros with databases | ||
| runs-on: ubuntu-latest | ||
| # Skip this job for version bump commits (binary won't exist yet) | ||
| if: "!contains(github.event.head_commit.message, 'Release')" | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| distro: | ||
| - ubuntu:20.04 | ||
| - ubuntu:22.04 | ||
| - ubuntu:24.04 | ||
| - debian:11 | ||
| - debian:12 | ||
| - alpine:3.18 | ||
| - alpine:3.19 | ||
| - fedora:38 | ||
| - fedora:39 | ||
| - archlinux:latest | ||
| db: | ||
| - mysql: 8 | ||
| - postgres: 16 | ||
| # Test fewer combinations to save CI time | ||
| exclude: | ||
| - distro: ubuntu:20.04 | ||
| db: { postgres: 16 } | ||
| - distro: ubuntu:22.04 | ||
| db: { postgres: 16 } | ||
| - distro: debian:11 | ||
| db: { postgres: 16 } | ||
| - distro: debian:12 | ||
| db: { mysql: 8 } | ||
| - distro: alpine:3.18 | ||
| db: { postgres: 16 } | ||
| - distro: alpine:3.19 | ||
| db: { mysql: 8 } | ||
| - distro: fedora:38 | ||
| db: { postgres: 16 } | ||
| - distro: fedora:39 | ||
| db: { mysql: 8 } | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Build docker-compose services | ||
| run: docker compose -f docker-compose.yml up -d | ||
| env: | ||
| MYSQL_VERSION: ${{ matrix.db.mysql }} | ||
| PG_VERSION: ${{ matrix.db.postgres }} | ||
| MYSQL_MIGRATION_FILE: "${{ matrix.db.mysql == '5.6' && 'mysql_migration_5_6.sql' || 'mysql_migration.sql' }}" | ||
|
|
||
| - name: Wait for databases to be ready | ||
| uses: GuillaumeFalourd/wait-sleep-action@v1 | ||
| with: | ||
| time: '10' | ||
|
|
||
| - name: Create test file | ||
| run: | | ||
| mkdir -p tests/staging | ||
| cat << 'TESTEOF' > tests/staging/distro-test.ts | ||
| import { sql } from 'sqlx-ts' | ||
|
|
||
| const selectSql = sql` | ||
| SELECT items.* | ||
| FROM items; | ||
| ` | ||
| TESTEOF | ||
|
|
||
| - name: Test npm install and run in ${{ matrix.distro }} container | ||
| run: | | ||
| docker run --rm \ | ||
| --network host \ | ||
| -v $(pwd):/workspace \ | ||
| -w /workspace \ | ||
| ${{ matrix.distro }} sh -c ' | ||
| # Install Node.js based on distro | ||
| if command -v apk > /dev/null; then | ||
| # Alpine | ||
| apk add --no-cache nodejs npm bash | ||
| elif command -v apt-get > /dev/null; then | ||
| # Debian/Ubuntu | ||
| apt-get update && apt-get install -y curl | ||
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - | ||
| apt-get install -y nodejs | ||
| elif command -v dnf > /dev/null; then | ||
| # Fedora | ||
| dnf install -y nodejs npm | ||
| fi | ||
|
|
||
| # Install sqlx-ts | ||
| cd node | ||
| npm install | ||
|
|
||
| # Verify installation | ||
| ./sqlx-ts --version | ||
| ./sqlx-ts --help | ||
|
|
||
| # Run integration test | ||
| ./sqlx-ts --config=../.sqlxrc.sample.json ../tests/staging | ||
|
|
||
| echo "✅ sqlx-ts npm package works on ${{ matrix.distro }} with DB" | ||
| ' | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.