From b7d8d17f7a39f7f77cc1608aa9da3a014337e489 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Sat, 10 Aug 2024 00:29:11 -0400 Subject: [PATCH] `publish`: add "portable" workflow with CPU features not enabled when you get an "illegal instruction" error, most likely its because the qsv binary is compiled with CPU features not available on the current system. CPU features that often increase performance, but are not universally available on all CPUs even for the same target platform (especially, on Virtual Machines) The "portable" binaries do not have these CPU features enabled. [skip ci] --- .github/workflows/publish-portable.yml | 220 +++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 .github/workflows/publish-portable.yml diff --git a/.github/workflows/publish-portable.yml b/.github/workflows/publish-portable.yml new file mode 100644 index 000000000..47dedfea6 --- /dev/null +++ b/.github/workflows/publish-portable.yml @@ -0,0 +1,220 @@ +name: Publish-Portable + +on: + push: + tags: + - '*' + workflow_dispatch: + +env: + QSV_KIND: prebuilt + +jobs: + analyze-tags: + runs-on: ubuntu-22.04 + outputs: + previous-tag: ${{ steps.previoustag.outputs.tag }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + #▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼# + - name: Get previous tag + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + #▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲# + # - name: delete git repo + # run: rm -rf qsv + + publish: + name: Publish for ${{ matrix.job.target }} + needs: analyze-tags + runs-on: ${{ matrix.job.os }} + strategy: + matrix: + rust: [stable] + job: + - os: ubuntu-22.04 + os-name: linux + target: x86_64-unknown-linux-gnu + architecture: x86_64 + use-cross: false + addl-build-args: --features=apply,luau,fetch,foreach,self_update,geocode,polars,to + default-features: + addl-qsvlite-features: + addl-qsvdp-features: luau,polars + addl-rustflags: + - os: ubuntu-22.04 + os-name: linux + target: x86_64-unknown-linux-musl + architecture: x86_64 + musl-prep: true + use-cross: false + addl-build-args: --features=apply,fetch,foreach,self_update + default-features: + addl-qsvlite-features: + addl-qsvdp-features: + addl-rustflags: + - os: ubuntu-22.04 + os-name: linux + target: i686-unknown-linux-gnu + architecture: i686 + use-cross: true + addl-build-args: --features=apply,fetch,foreach,self_update + default-features: + addl-qsvlite-features: + addl-qsvdp-features: + addl-rustflags: + - os: windows-latest + os-name: windows + target: x86_64-pc-windows-msvc + architecture: x86_64 + use-cross: false + addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to + default-features: + addl-qsvlite-features: + addl-qsvdp-features: luau + addl-rustflags: + - os: windows-latest + os-name: windows + target: i686-pc-windows-msvc + architecture: i686 + use-cross: true + addl-build-args: --features=apply,fetch,self_update + default-features: + addl-qsvlite-features: + addl-qsvdp-features: + addl-rustflags: + - os: windows-latest + os-name: windows + target: x86_64-pc-windows-gnu + architecture: x86_64 + use-cross: false + addl-build-args: --features=apply,luau,fetch,self_update,geocode,polars,to + default-features: --no-default-features + addl-qsvlite-features: + addl-qsvdp-features: luau + addl-rustflags: + # - os: macos-12 + # os-name: macos + # target: x86_64-apple-darwin + # architecture: x86_64 + # use-cross: false + # addl-build-args: --features=apply,luau,fetch,foreach,self_update,polars + # default-features: --no-default-features + # addl-qsvlite-features: + # addl-qsvdp-features: luau + # - os: macos-12 + # os-name: macos + # target: aarch64-apple-darwin + # architecture: aarch64 + # use-cross: true + # addl-build-args: --features=apply,fetch,foreach,self_update + # default-features: --no-default-features + # addl-qsvlite-features: + # addl-qsvdp-features: + - os: ubuntu-22.04 + os-name: linux + target: aarch64-unknown-linux-gnu + architecture: aarch64 + use-cross: true + addl-build-args: --features=apply,fetch,foreach,self_update + default-features: + addl-qsvlite-features: + addl-qsvdp-features: + addl-rustflags: + # - os: ubuntu-20.04 + # os-name: linux + # target: arm-unknown-linux-gnueabihf + # architecture: arm + # use-cross: true + # addl-build-args: --features=apply,luau,fetch,foreach,self_update + # default-features: --no-default-features + # - os: ubuntu-20.04 + # os-name: linux + # target: arm-unknown-linux-musleabihf + # architecture: arm + # use-cross: true + # addl-build-args: --features=apply,luau,fetch,foreach,self_update + # default-features: --no-default-features + + steps: + - name: Installing Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + profile: minimal + target: ${{ matrix.job.target }} + override: true + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ needs.analyze-tags.outputs.previous-tag }} + - name: build prep for x86_64-unknown-linux-musl + if: ${{ matrix.job.musl-prep }} + run: | + sudo apt-get install musl-tools musl-dev + sudo ln -s /usr/bin/g++ /usr/bin/musl-g++ + - name: Build qsv + # env: + # RUSTFLAGS: --emit=asm + env: + RUSTFLAGS: ${{ matrix.job.addl-rustflags }} + uses: actions-rs/cargo@v1 + with: + command: build + use-cross: ${{ matrix.job.use-cross }} + toolchain: ${{ matrix.rust }} + args: --release --locked --bin qsv --target ${{ matrix.job.target }} ${{ matrix.job.addl-build-args }},feature_capable ${{ matrix.job.default-features }} + - name: Build qsvlite + env: + RUSTFLAGS: --emit=asm ${{ matrix.job.addl-rustflags }} + uses: actions-rs/cargo@v1 + with: + command: build + use-cross: ${{ matrix.job.use-cross }} + toolchain: ${{ matrix.rust }} + args: --release --locked --bin qsvlite --features=lite,self_update,${{ matrix.job.addl-qsvlite-features }} --target ${{ matrix.job.target }} ${{ matrix.job.default-features }} + - name: Build qsvdp + env: + RUSTFLAGS: --emit=asm ${{ matrix.job.addl-rustflags }} + uses: actions-rs/cargo@v1 + with: + command: build + use-cross: ${{ matrix.job.use-cross }} + toolchain: ${{ matrix.rust }} + args: --release --locked --bin qsvdp --features=datapusher_plus,${{ matrix.job.addl-qsvdp-features }} --target ${{ matrix.job.target }} ${{ matrix.job.default-features }} + - name: Copy binaries to working dir + shell: bash + run: | + mkdir qsv-${{ needs.analyze-tags.outputs.previous-tag }} + rm target/${{ matrix.job.target }}/release/*.d + cp -v target/${{ matrix.job.target }}/release/qsv* qsv-${{ needs.analyze-tags.outputs.previous-tag }} + - name: Create README + shell: bash + run: | + cat docs/publishing_assets/README.txt docs/publishing_assets/qsv-${{ matrix.job.target }}.txt > qsv-${{ needs.analyze-tags.outputs.previous-tag }}/README + - name: zip up binaries + run: 7z a -tzip qsv-${{ needs.analyze-tags.outputs.previous-tag }}-${{ matrix.job.target }}-portable.zip ./qsv-${{ needs.analyze-tags.outputs.previous-tag }}/* -mx=9 -mmt=on + - name: install zipsign + run: | + cargo install zipsign + - name: Fetch zipsign private key + uses: mobiledevops/secret-to-file-action@v1 + with: + base64-encoded-secret: ${{ secrets.QSV_ZIPSIGN_PRIV_KEY }} + filename: "qsvpriv.key" + is-executable: false + working-directory: "." + - name: zipsign binary + run: | + zipsign sign zip qsv-${{ needs.analyze-tags.outputs.previous-tag }}-${{ matrix.job.target }}-portable.zip qsvpriv.key + - name: Upload zipped binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: qsv-${{ needs.analyze-tags.outputs.previous-tag }}-${{ matrix.job.target }}-portable.zip + asset_name: qsv-${{ needs.analyze-tags.outputs.previous-tag }}-${{ matrix.job.target }}-portable.zip + overwrite: true + tag: ${{ needs.analyze-tags.outputs.previous-tag }} +