attempt to no longer depend on system library presence for autodetection #47
This file contains 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
name: windows-artifacts | |
on: | |
push: | |
branches: [ test_artifacts, win_artifacts, release ] | |
release: | |
types: | |
- published | |
permissions: read-all | |
jobs: | |
windows-artifacts: | |
permissions: | |
contents: write # to fetch code and upload artifacts | |
# see https://ariya.io/2020/07/on-github-actions-with-msys2 | |
runs-on: windows-latest | |
# see https://github.com/msys2/setup-msys2 | |
strategy: | |
matrix: | |
include: | |
- { msystem: mingw64, env: x86_64, ziparch: win64 } | |
- { msystem: mingw32, env: i686, ziparch: win32 } | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 | |
- uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # tag=v2.27.0 | |
with: | |
msystem: ${{ matrix.msystem }} | |
install: make p7zip git mingw-w64-${{matrix.env}}-gcc | |
update: true | |
- name: display versions | |
run: | | |
make -v | |
cc -v | |
- name: Building zlib to static link | |
run: | | |
git clone --depth 1 --branch v1.3.1 https://github.com/madler/zlib | |
make -C zlib -f win32/Makefile.gcc libz.a | |
- name: Building lz4 to static link | |
run: | | |
git clone --depth 1 --branch v1.10.0 https://github.com/lz4/lz4 | |
# ensure both libraries use the same version of libxxhash | |
cp lib/common/xxhash.* lz4/lib | |
CPPFLAGS=-DXXH_NAMESPACE=LZ4_ make -C lz4/lib liblz4.a V=1 | |
- name: Building zstd programs | |
run: | | |
CPPFLAGS="-I../zlib -I../lz4/lib" LDFLAGS=-static make -j allzstd V=1 HAVE_ZLIB=1 HAVE_LZ4=1 HAVE_LZMA=0 LDLIBS="../zlib/libz.a ../lz4/lib/liblz4.a" | |
- name: Create artifacts | |
run: | | |
./lib/dll/example/build_package.bat || exit 1 | |
mv bin/ zstd-${{ github.ref_name }}-${{matrix.ziparch}}/ | |
- name: Publish zstd-$VERSION-${{matrix.ziparch}}.zip for manual inspection | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # tag=v4.3.1 | |
with: | |
compression-level: 9 # maximum compression | |
if-no-files-found: error # defaults to `warn` | |
path: ${{ github.workspace }}/zstd-${{ github.ref_name }}-${{matrix.ziparch}}/ | |
name: zstd-${{ github.ref_name }}-${{matrix.ziparch}} | |
- name: Package artifact for upload | |
run: | | |
7z a -tzip -mx9 "$(cygpath -u '${{ github.workspace }}/zstd-${{ github.ref_name }}-${{ matrix.ziparch }}.zip')" "$(cygpath -u '${{ github.workspace }}/zstd-${{ github.ref_name }}-${{ matrix.ziparch }}')" | |
- name: Upload release asset | |
if: github.event_name == 'release' | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload "${{ github.ref_name }}" "$env:GITHUB_WORKSPACE/zstd-${{ github.ref_name }}-${{ matrix.ziparch }}.zip" --clobber | |