2020 - x86_64-unknown-linux-gnu
2121 - aarch64-unknown-linux-gnu
2222 - armv7-unknown-linux-gnueabihf
23+ linker : [ static, dynamic ]
2324
2425 steps :
2526 - uses : actions/checkout@v3
4041
4142 - run : cargo install --force cross --git https://github.com/cross-rs/cross
4243 - run : cargo install --force cargo-deb
43- # - run: cargo install --force cargo-generate-rpm
44+ if : matrix.linker == 'dynamic'
45+ # - run: cargo install --force cargo-generate-rpm
4446
4547 - name : Find Version
4648 if : startsWith(github.ref, 'refs/tags/')
@@ -59,43 +61,53 @@ jobs:
5961
6062 sed -i'' "s/0\\.0\\.0-git/${{ steps.meta.outputs.version }}/" Cargo.lock
6163
64+ - name : Configure for static
65+ run : |
66+ if [[ '${{ matrix.linker }}' == 'static' ]]; then
67+ echo 'RUSTFLAGS=-C target-feature=+crt-static' >> $GITHUB_ENV
68+ echo 'NAME_PREFIX=_static' >> $GITHUB_ENV
69+ fi
70+
6271 - name : Build
6372 run : cross build --release --target ${{ matrix.target }}
6473
6574 - name : Build deb
75+ if : matrix.linker == 'dynamic'
6676 run : |
6777 cargo deb --no-build --no-strip --target ${{ matrix.target }} -p zia-client
6878 cargo deb --no-build --no-strip --target ${{ matrix.target }} -p zia-server
6979
70- # - name: Build rpm
71- # run: |
72- # cargo generate-rpm --target ${{ matrix.target }} -p zia-client
73- # cargo generate-rpm --target ${{ matrix.target }} -p zia-server
80+ # - name: Build rpm
81+ # run: |
82+ # cargo generate-rpm --target ${{ matrix.target }} -p zia-client
83+ # cargo generate-rpm --target ${{ matrix.target }} -p zia-server
7484
7585 - name : Rename binary
7686 run : |
77- mv target/${{ matrix.target }}/release/zia-client zia-client_${{ matrix.target }}
78- mv target/${{ matrix.target }}/release/zia-server zia-server_${{ matrix.target }}
87+ mv target/${{ matrix.target }}/release/zia-client zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}
88+ mv target/${{ matrix.target }}/release/zia-server zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}
7989
8090 - name : Upload Artifact (client)
8191 uses : actions/upload-artifact@v3
8292 with :
83- name : zia-client_${{ matrix.target }}
84- path : zia-client_${{ matrix.target }}*
93+ name : zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}
94+ path : zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }}
8595
8696 - name : Upload Artifact (server)
8797 uses : actions/upload-artifact@v3
8898 with :
89- name : zia-server_${{ matrix.target }}
90- path : zia-server_${{ matrix.target }}*
99+ name : zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}
100+ path : zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}
91101
92102 - name : Upload Artifact deb (client)
103+ if : matrix.linker == 'dynamic'
93104 uses : actions/upload-artifact@v3
94105 with :
95106 name : zia-client_${{ matrix.target }}.deb
96107 path : target/${{ matrix.target }}/debian/zia-client_*.deb
97108
98109 - name : Upload Artifact deb (server)
110+ if : matrix.linker == 'dynamic'
99111 uses : actions/upload-artifact@v3
100112 with :
101113 name : zia-server_${{ matrix.target }}.deb
@@ -106,7 +118,7 @@ jobs:
106118 env :
107119 GITHUB_TOKEN : ${{ github.token }}
108120 with :
109- asset_paths : ' ["zia-client_${{ matrix.target }}","zia-server_${{ matrix.target }}","target/${{ matrix.target }}/debian/zia-client_${{ steps.meta.outputs.version }}_*.deb","target/${{ matrix.target }}/debian/zia-server_${{ steps.meta.outputs.version }}_*.deb"]'
121+ asset_paths : ' ["zia-client_${{ matrix.target }}${{ env.NAME_PREFIX }} ","zia-server_${{ matrix.target }}${{ env.NAME_PREFIX }}","target/${{ matrix.target }}/debian/zia-client_${{ steps.meta.outputs.version }}_*.deb","target/${{ matrix.target }}/debian/zia-server_${{ steps.meta.outputs.version }}_*.deb"]'
110122
111123 build-native :
112124 needs : [ build ]
0 commit comments