Skip to content

try without subfolder name #358

try without subfolder name

try without subfolder name #358

Workflow file for this run

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@v4
- name: version
id: version
run: |
version=$(grep -oP 'VERSION = "\K[^"]+' main.c)
echo "VERSION=$version" >> $GITHUB_OUTPUT
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name == 'master' && steps.version.outputs.version || format ('{0}-{1}', steps.version.outputs.version, steps.vars.outputs.COMMIT_SHORT_SHA) }}
name: ${{ github.ref_name == 'master' && format ('Release {0}' , steps.version.outputs.version ) || format('Build {0}{1} on {2} ({3}) {4}', github.run_number, github.run_attempt == 1 && '' || format('.{0}', github.run_attempt), github.ref_name , steps.vars.outputs.COMMIT_SHORT_SHA , github.event.head_commit.message ) }}
draft: true
prerelease: true
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
version: ${{ steps.version.outputs.version }}
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
# smoke_test:
# needs: [ build, create_release ]
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, windows-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Download Release
# uses: robinraju/[email protected]
# with:
# releaseId: ${{ needs.create_release.outputs.release_id }}
# fileName: cliffi-${{ matrix.os == 'windows-latest' && 'windows-static-x64.exe' || 'linux-x64' }}
# - name: Run Smoke Test
# run: |
# ls -al
# mv cliffi-* cliffi
# chmod +x cliffi
# ./cliffi libc i strlen test
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 }}"
bump_homebrew:
name: Bump Homebrew formula
needs: [build, create_release, finalize_release]
if: github.ref == 'refs/heads/master' && needs.build.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Bump the Homebrew formula
uses: mislav/bump-homebrew-formula-action@v3
env:
COMMITTER_TOKEN: ${{ secrets.TOKEN }}
with:
homebrew-tap: YSaxon/homebrew-cliffi
formula-name: cliffi
tag-name: ${{ needs.create_release.outputs.version }}
download-url: https://github.com/YSaxon/cliffi/archive/refs/tags/${{ github.event.inputs.tag-name }}.tar.gz