@@ -44,187 +44,3 @@ jobs:
4444 push : true
4545 tags : ${{ steps.meta.outputs.tags }}
4646 labels : ${{ steps.meta.outputs.labels }}
47-
48- build_binaries :
49- strategy :
50- matrix :
51- # unless we want windows binaries as well, keep the matrix as is
52- os : [ubuntu-latest, macos-latest, macos-arm64]
53- runs-on : ${{ matrix.os }}
54- steps :
55- # for windows only, use correct newlines
56- - name : Set git to use LF
57- if : matrix.os == 'windows-latest'
58- run : |
59- git config --global core.autocrlf false
60- git config --global core.eol lf
61-
62- - uses : actions/checkout@v3
63- if : ${{ github.event.inputs.tag }} == "v0.0.0"
64- with :
65- ref : ${{ github.event.inputs.tag }}
66-
67- - uses : actions/checkout@v3
68- if : ${{ github.event.inputs.tag }} != "v0.0.0"
69-
70- - name : Get Rust toolchain version from rust-toolchain.toml
71- id : getrustver
72- run : |
73- echo "RUST_VER=$(grep channel ./rust-toolchain.toml | awk '{print $NF}' | tr -d '"')" >> $GITHUB_ENV
74-
75- - uses : dtolnay/rust-toolchain@master
76- with :
77- toolchain : ${{ env.RUST_VER }}
78-
79- # Check Cargo.toml in sqld sbdir has the correct tag
80- - name : Verify sqld/Cargo.toml version is same as git tag
81- if : ${{ startsWith(github.ref, 'refs/tags/') }} && ${{ matrix.os }} == ubuntu-latest
82- id : check-tag
83- run : |
84- VER=$(echo ${{ github.ref_name }}|tr -d "v")
85- pushd sqld
86- CARGOVER=$(cargo metadata --no-deps | jq '.packages | .[] | select(.name == "sqld") | .version'|tr -d '"')
87- popd
88- if [[ "$VER" != "$CARGOVER" ]]; then
89- echo "FAILED_TAG=1" >> $GITHUB_OUTPUT
90- else
91- echo "FAILED_TAG=0" >> $GITHUB_OUTPUT
92- fi
93-
94- #Special case when we've pushed to main
95- if [[ "${{ github.ref_name }}" == "main" ]]; then
96- echo "FAILED_TAG=0" >> $GITHUB_OUTPUT
97- fi
98-
99- # TODO: old bash-y check, delete if the above method works ok on all platforms
100- # FLAG=0
101- # FAILED_TAG=0
102- # CARGOVER=""
103- # IFS=
104- # while read -r line; do
105- # echo "Cargo.toml: $line"
106- # if [[ "$line" =~ ^"[package]" ]]; then FLAG=1; fi
107- # if [[ "$FLAG" == 1 ]]; then
108- # if [[ "$line" =~ ^"version =" ]]; then
109- # CARGOVER=$(echo $line|awk '{ print $NF }'|tr -d '"')
110- # echo "_cargover = $CARGOVER"
111- # if [[ "$CARGOVER" != "$VER" ]]; then
112- # FLAG=2
113- # else
114- # FLAG=0
115- # fi
116- # fi
117- # fi
118- # done < sqld/Cargo.toml
119- # if [[ "$FLAG" == 2 ]]; then
120- # echo "FAILED_TAG=1" >> $GITHUB_OUTPUT
121- # else
122- # echo "FAILED_TAG=0" >> $GITHUB_OUTPUT
123- # fi
124- # echo "cargover = $CARGOVER"
125- # echo "failed tag = $FAILED_TAG"
126- # echo "ver = $VER"
127-
128- # If the tag is wrong, fail the job
129- - name : Check for failed tag
130- if : steps.check-tag.outputs.FAILED_TAG == 1 && matrix.os == 'ubuntu-latest'
131- uses : actions/github-script@v3
132- with :
133- script : |
134- core.setFailed('ERROR: sqld/Cargo.toml version section has not been updated to the release tag. Failing the release build.')
135-
136- - name : setup msys2 for windows
137- if : matrix.os == 'windows-latest'
138- uses : msys2/setup-msys2@v2
139- with :
140- update : true
141- install : mingw-w64-x86_64-toolchain mingw-w64-x86_64-sqlite3 gcc make base-devel mingw-w64-x86_64-rust zip
142- msystem : mingw64
143- path-type : inherit
144-
145- - name : Build sqld (windows)
146- if : matrix.os == 'windows-latest'
147- run : |
148- export CARGO_BIN="$(which cargo)"
149- cargo build --release
150- shell : msys2 {0}
151-
152- - name : Zip artifact for deployment (windows)
153- if : matrix.os == 'windows-latest'
154- # run: zip sqld-${{ github.event.inputs.tag }}-${{ matrix.os }}.zip ./target/release/sqld
155- run : |
156- cd ./target/release
157- zip ../../sqld-${{ github.ref_name }}-${{ matrix.os }}.zip sqld
158- cd ../../
159- shell : msys2 {0}
160-
161- - name : install dependencies (linux)
162- if : matrix.os == 'ubuntu-latest'
163- run : |
164- sudo apt install --yes \
165- bundler \
166- libpq-dev \
167- libsqlite3-dev \
168- nodejs \
169- protobuf-compiler
170-
171- - name : install dependencies (macos)
172- if : startsWith(matrix.os, 'macos')
173- run : |
174- brew install llvm || /opt/homebrew/bin/brew install llvm
175- brew install pkg-config || /opt/homebrew/bin/brew install pkg-config
176- brew install protobuf || /opt/homebrew/bin/brew install protobuf
177-
178- - name : Build sqld (linux/macos)
179- if : matrix.os != 'windows-latest'
180- run : |
181- cargo -V
182- git status
183- git describe --tags
184- cargo build --release
185-
186- - name : Zip artifact for deployment (linux)
187- if : matrix.os == 'ubuntu-latest'
188- # run: zip sqld-${{ github.event.inputs.tag }}-${{ matrix.os }}.zip ./target/release/sqld
189- run : |
190- pushd ./target/release
191- #zip ../../sqld-${{ github.ref_name }}-linux-x86_64.zip sqld
192- tar czvf ../../sqld-${{ github.ref_name }}-linux-x86_64.tar.gz sqld
193- popd
194-
195- - name : Zip artifact for deployment (macos)
196- if : startsWith(matrix.os, 'macos')
197- run : |
198- uname -a
199- OS=$(uname -s)
200- ARCH=$(uname -m)
201- pushd ./target/release
202- zip ../../sqld-${{ github.ref_name }}-$OS-$ARCH.zip sqld
203- popd
204-
205- # - uses: actions/upload-artifact@v3
206- # if: matrix.os == 'macos-latest'
207- # with:
208- # name: sqld-${{ github.ref_name }}-darwin-x86
209- # path: sqld-${{ github.ref_name }}-darwin-x86.zip
210- # retention-days: 1
211- #
212- # - uses: actions/upload-artifact@v3
213- # if: matrix.os == 'ubuntu-latest'
214- # with:
215- # name: sqld-${{ github.ref_name }}
216- # path: |
217- # sqld-${{ github.ref_name }}-linux-x86_64.tar.gz
218- # retention-days: 1
219-
220-
221- - name : Push artefacts into release draft
222- uses : softprops/action-gh-release@v1
223- if : ${{startsWith(github.ref, 'refs/tags/') }}
224- with :
225- fail_on_unmatched_files : false
226- files : |
227- sqld-${{ github.ref_name }}-linux-x86_64.tar.gz
228- sqld-${{ github.ref_name }}-Darwin-x86_64.zip
229- sqld-${{ github.ref_name }}-Darwin-arm64.zip
230-
0 commit comments