-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (84 loc) · 3.2 KB
/
linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
on:
push:
branches:
- main
pull_request:
name: Linux
jobs:
build_and_test:
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: |
# 2.3.6-0.1build1 is hack workaround for Microsoft unixodbc-dev being installed, which has no static files!
sudo apt-get update
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y --allow-downgrades --no-install-recommends unixodbc-dev=2.3.6-0.1build1 libodbc1=2.3.6-0.1build1 odbcinst1debian2=2.3.6-0.1build1 odbcinst=2.3.6-0.1build1 odbc-postgresql libsqliteodbc
sudo pg_ctlcluster 14 main start || true
sudo pg_lsclusters
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
- uses: actions/checkout@v4
- 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
- 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-20.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@v4
- uses: actions/cache@v3
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: 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
if: ${{ matrix.build_arch == 'amd64'}}
run: |
docker run --platform ${{ matrix.build_platform }} --name wait_for_db wait_for_db --help
- name: Docker copy
if: ${{ matrix.build_arch == 'amd64'}}
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