Merge pull request #86 from palfrey/remove-default-features #269
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
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| name: Linux | |
| jobs: | |
| build_and_test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y --allow-downgrades --no-install-recommends unixodbc-dev=2.3.12-1build2 libodbc2=2.3.12-1build2 libodbcinst2=2.3.12-1build2 odbcinst=2.3.12-1build2 libodbccr2=2.3.12-1build2 odbc-postgresql libsqliteodbc libltdl-dev | |
| sudo pg_ctlcluster 16 main start || true | |
| sudo pg_lsclusters | |
| sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| - name: Clippy | |
| run: cargo clippy -- -D warnings | |
| - name: Build and test | |
| env: | |
| ODBC_SYS_STATIC_PATH: /usr/lib/x86_64-linux-gnu/ | |
| POSTGRES_DRIVER: /usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so | |
| SQLITE_DRIVER: /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so | |
| POSTGRES_SERVER: localhost | |
| POSTGRES_PORT: 5432 | |
| POSTGRES_USERNAME: postgres | |
| POSTGRES_PASSWORD: postgres | |
| RUST_BACKTRACE: 1 | |
| run: cargo test -- --nocapture | |
| docker: | |
| runs-on: ubuntu-24.04 | |
| needs: [build_and_test] | |
| strategy: | |
| matrix: | |
| include: | |
| - build_platform: linux/amd64 | |
| build_host: x86_64-unknown-linux-musl | |
| build_arch: amd64 | |
| - build_platform: linux/arm64 | |
| build_host: aarch64-unknown-linux-musl | |
| build_arch: arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /tmp/.buildx-cache | |
| key: | |
| buildx-${{ matrix.build_host }}-${{hashFiles('Dockerfile')}} | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| platforms: ${{ matrix.build_platform }} | |
| - name: Setup Qemu | |
| if: ${{ matrix.build_arch != 'amd64'}} | |
| run: | | |
| docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
| - name: Docker build | |
| run: | | |
| docker buildx build --platform ${{ matrix.build_platform }} --build-arg HOST=${{ matrix.build_host }} --tag wait_for_db:latest --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max --output=type=docker . | |
| - name: Docker help test | |
| run: | | |
| docker run --platform ${{ matrix.build_platform }} --name wait_for_db wait_for_db --help | |
| - name: Docker copy | |
| run: | | |
| docker cp wait_for_db:/wait_for_db wait-for-db-linux-${{ matrix.build_arch }} | |
| - name: ldd check | |
| if: ${{ matrix.build_arch == 'amd64'}} | |
| run: | | |
| ldd wait-for-db-linux-${{ matrix.build_arch }} | grep "statically linked" | |
| retVal=$? | |
| if [ $retVal -ne 0 ]; then | |
| ldd wait-for-db-linux-${{ matrix.build_arch }} | |
| echo Found local non-static refs! | |
| exit 1 | |
| fi | |
| - name: Archive binary | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: wait-for-db-linux-${{ matrix.build_arch }} | |
| path: wait-for-db-linux-${{ matrix.build_arch }} |