more try fix autoreleaser #271
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: Cross-Platform Build and Test | |
permissions: | |
contents: write | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
create_release: | |
name: create_release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: version | |
id: version | |
# parse the VERSION from main.c | |
run: echo ::set-output name=version::$(grep -oP 'VERSION = "\K[^"]+' main.c) | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.version.outputs.version }} | |
release_name: ${{ github.ref_name == 'master' && 'Release' || 'DevBuild' }} ${{ steps.version.outputs.version }} | |
draft: true | |
prerelease: true | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
release_id: ${{ steps.create_release.outputs.id }} | |
build: | |
runs-on: ubuntu-latest | |
needs: create_release | |
strategy: | |
fail-fast: false | |
matrix: | |
dockcross_image: | |
- android-arm | |
- android-arm64 | |
- android-x86 | |
- android-x86_64 | |
- linux-arm64 | |
# - linux-arm64-lts | |
# - linux-arm64-full | |
# - linux-arm64-musl | |
- linux-armv5 | |
# - linux-armv5-musl | |
# - linux-armv5-uclibc | |
- linux-armv6 | |
# - linux-armv6-lts | |
# - linux-armv6-musl | |
- linux-armv7 | |
# - linux-armv7-lts | |
# - linux-armv7a | |
# - linux-armv7l-musl | |
- linux-mips | |
# - linux-mips-uclibc | |
- linux-mips-lts | |
# - linux-mipsel-lts | |
- linux-s390x | |
- linux-ppc64le | |
# - linux-ppc64le-lts | |
- linux-riscv32 | |
- linux-riscv64 | |
# - linux-m68k-uclibc | |
# - linux-xtensa-uclibc | |
# - manylinux_2_28-x64 | |
# - manylinux2014-x86 | |
# - manylinux2014-x64 | |
# - linux-i686 | |
- linux-x86 | |
- linux-x64 | |
# - linux-x86_64-full | |
# - linux-x64-clang | |
# - linux-x64-tinycc | |
# - web-wasm | |
# - web-wasi | |
# - windows-shared-x86 | |
# - windows-shared-x64 | |
# - windows-shared-x64-posix | |
- windows-static-x86 | |
- windows-static-x64 | |
# - windows-static-x64-posix | |
# - windows-armv7 #no idea why this one doesn't work | |
- windows-arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: cache docker image | |
id: cache_docker_image | |
uses: actions/cache@v4 | |
with: | |
path: ~/.docker | |
key: ${{ runner.os }}-docker-${{ matrix.dockcross_image }} | |
- name: cache dockcross script | |
id: cache_dockcross | |
uses: actions/cache@v4 | |
with: | |
path: dockcross | |
key: ${{ runner.os }}-dockcross-${{ matrix.dockcross_image }} | |
- name: cache conan | |
id: cache_conan | |
uses: actions/cache@v4 | |
with: | |
path: .conan2 | |
key: ${{ runner.os }}-conan-${{ matrix.dockcross_image }} | |
- name: install helper script | |
if: steps.cache_docker_image.outputs.cache-hit != 'true' || steps.cache_dockcross.outputs.cache-hit != 'true' | |
run: | | |
docker run --rm dockcross/${{ matrix.dockcross_image }} > ./dockcross | |
chmod +x ./dockcross | |
- name: test dockcross | |
run: | | |
./dockcross bash -c "echo hello world" | |
- name: everything together | |
#exclude android builds | |
if: (startsWith(matrix.dockcross_image, 'android') || startsWith(matrix.dockcross_image, 'windows-arm') || contains(matrix.dockcross_image,'s390x')) == false | |
run: | | |
./dockcross bash ./dockcross_buildtest.sh | |
- name: build without testing (android) | |
#only android builds | |
if: (startsWith(matrix.dockcross_image, 'android') || startsWith(matrix.dockcross_image, 'windows-arm') || contains(matrix.dockcross_image,'s390x')) == true | |
run: | | |
./dockcross bash ./dockcross_buildonly.sh | |
# - name: conaninstall | |
# run: | | |
# ./dockcross bash -c "./profile_script.sh && conan install . --output-folder=build --build=missing -pr build" | |
# - name: updatecmake | |
# run: | | |
# ./dockcross bash ./update_cmake.sh | |
# sleep 10s | |
# - name: cmake | |
# run: | | |
# ./dockcross bash -c "mkdir -p build && rm -rf build/* CMakeCache.txt CMakeFiles && cd build && cmake .." | |
# - name: make | |
# run: | | |
# ./dockcross bash -c "cd build && make" | |
# - name: ctest | |
# run: | | |
# ./dockcross bash -c "cd build && ctest --output-on-failure" | |
- name: get_executable | |
id: get_executable | |
run: | | |
echo "executable=$(ls build/cliffi*)" >> $GITHUB_OUTPUT | |
- name: upload | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
# it could be plain cliffi or cliffi.exe | |
asset_path: ${{ steps.get_executable.outputs.executable }} | |
#add -untested for android or windows-arm builds | |
asset_name: cliffi-${{ matrix.dockcross_image }}${{ (startsWith(matrix.dockcross_image, 'android') || startsWith(matrix.dockcross_image, 'windows-arm' || contains(matrix.dockcross_image,'s390x'))) && '-untested' || '' }}${{ (startsWith(matrix.dockcross_image, 'windows') && '.exe') || ''}} | |
asset_content_type: application/zip | |
finalize_release: | |
needs: [build, create_release] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && needs.build.result == 'success' | |
steps: | |
- name: Finalize Release | |
run: | | |
curl \ | |
-X PATCH \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-d '{"draft": false, "prerelease": false, "make_latest": true}' \ | |
"https://api.github.com/repos/${{ github.repository }}/releases/${{ needs.create_release.outputs.release_id }}" |