Merge pull request #1052 from lifting-bits/dependabot/github_actions/… #1161
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: MacOS Continuous Integration | |
env: | |
# "Source" is set in the setup-dotnet action | |
VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite;nugettimeout,3601' | |
VCPKG_DEFAULT_HOST_TRIPLET: 'x64-osx-rel' | |
on: | |
release: | |
types: | |
- published | |
pull_request: | |
paths-ignore: | |
- 'docker/**' | |
- '.github/**' | |
- '**.md' | |
- '!.github/workflows/vcpkg_ci_mac.yml' | |
push: | |
paths-ignore: | |
- 'docker/**' | |
- '.github/**' | |
- '**.md' | |
- '!.github/workflows/vcpkg_ci_mac.yml' | |
tags-ignore: | |
- 'v*' | |
branches: | |
- 'master' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- { runner: 'macos-13', xcode: '15.0' } | |
llvm: [ | |
'llvm-16', | |
'llvm-17', | |
'llvm-17[liftingbits-llvm]' | |
] | |
target_arch: [ 'x64', 'arm64' ] | |
runs-on: ${{ matrix.os.runner }} | |
steps: | |
- name: Set Artifact Name | |
run: | | |
# Need to fix because paths with brackets cause issues | |
NAME="$(echo 'vcpkg_${{ matrix.os.runner }}_${{ matrix.llvm }}_xcode-${{ matrix.os.xcode }}_${{ matrix.target_arch == 'x64' && 'amd64' || matrix.target_arch }}' | tr '[' '-' | tr -d ']')" | |
echo "ARTIFACT_NAME=${NAME}" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 2 | |
# Used to get commit message since PRs are on a merge commit | |
- name: Get commit message | |
run: | | |
echo 'COMMIT_MESSAGE<<EOF' >> "$GITHUB_ENV" | |
if [[ '${{ github.event_name }}' == 'push' ]]; then | |
echo "$(git log --format=%B -n 1 HEAD)" >> "$GITHUB_ENV" | |
elif [[ '${{ github.event_name }}' == 'pull_request' ]]; then | |
echo "$(git log --format=%B -n 1 HEAD^2)" >> "$GITHUB_ENV" | |
fi | |
echo "EOF" >> "$GITHUB_ENV" | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '3.1.x' # SDK Version to use. | |
# Sets as "Source" | |
source-url: https://nuget.pkg.github.com/lifting-bits/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Select the XCode version | |
run: | | |
echo "Selecting XCode Version ${{ matrix.os.xcode }}" | |
sudo xcode-select -s /Applications/Xcode_${{ matrix.os.xcode }}.app/Contents/Developer | |
- name: Initialize vcpkg | |
shell: bash | |
run: | | |
{ read -r vcpkg_repo_url && read -r vcpkg_commit; } <./vcpkg_info.txt || exit 1 | |
git clone "${vcpkg_repo_url}" | |
git -C vcpkg checkout "${vcpkg_commit}" | |
export VCPKG_DISABLE_METRICS=1 | |
./vcpkg/bootstrap-vcpkg.sh | |
echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV | |
- name: 'vcpkg install dependencies' | |
shell: 'bash' | |
run: | | |
export VCPKG_DISABLE_METRICS=1 | |
brew install bash ninja | |
# Setup NuGet authentication | |
mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" setapikey \ | |
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ | |
"${{ secrets.GITHUB_TOKEN }}" | |
./build_dependencies.sh --release --target-arch ${{ matrix.target_arch }} --export-dir ./${{ env.ARTIFACT_NAME }} ${{ matrix.llvm }} --clean-after-build --debug | |
echo "VCPKG_ROOT=$(pwd)/${{ env.ARTIFACT_NAME }}" >> $GITHUB_ENV | |
echo "TARGET_TRIPLET=${{ matrix.target_arch }}-osx-rel" >> $GITHUB_ENV | |
- name: Upload CMake logs on error | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }}_logs | |
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log | |
- name: 'Adhoc codesign' | |
shell: 'bash' | |
run: | | |
find ./${{ env.ARTIFACT_NAME }} \( -path '**/bin/*' -or -path '**/libexec/*' -or -path '**/tools/*' \) -type f -perm +111 -exec codesign --force -s - \{\} \; | |
- name: 'Export Packages' | |
if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release | |
shell: 'bash' | |
run: | | |
brew install pixz | |
tar --use-compress-program pixz -cf "${{ env.ARTIFACT_NAME }}.tar.xz" ./${{ env.ARTIFACT_NAME }} | |
- name: Publish Release Assets | |
if: github.event.release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ env.ARTIFACT_NAME }}.tar.xz | |
prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }} | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release | |
with: | |
name: ${{ env.ARTIFACT_NAME }}.tar.xz | |
path: ${{ env.ARTIFACT_NAME }}.tar.xz | |
- name: 'Install build dependencies' | |
shell: 'bash' | |
run: | | |
brew install ninja ccache | |
- name: Prepare ccache | |
id: ccache_prep | |
shell: bash | |
run: | | |
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV | |
echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV | |
echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV | |
echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV | |
echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV | |
echo "timestamp=$(python -c 'from datetime import datetime; print(datetime.utcnow().strftime("%Y-%m-%d-%H:%M:%S"))')" >> ${GITHUB_OUTPUT} | |
- name: ccache cache files | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.ccache | |
key: ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-${{ matrix.target_arch }}-${{ steps.ccache_prep.outputs.timestamp }} | |
restore-keys: | | |
ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-$${{ matrix.target_arch }} | |
- name: ccache Initial stats | |
shell: bash | |
run: | | |
ccache --show-stats | |
- name: 'Rellic build' | |
shell: 'bash' | |
working-directory: rellic | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
cmake -G Ninja \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ | |
-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ | |
-DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \ | |
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \ | |
"-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ | |
-S . -B build | |
cmake --build build | |
cmake --install build | |
- name: 'Rellic test' | |
shell: 'bash' | |
working-directory: rellic | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
cmake --build build --target test | |
- name: 'Remill dependencies' | |
shell: 'bash' | |
working-directory: remill | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
python3 -m pip install poetry | |
python3 -m pip install --user ./scripts/diff_tester_export_insns | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: 'Remill build' | |
shell: 'bash' | |
working-directory: remill | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
cmake -G Ninja \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ | |
-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ | |
-DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \ | |
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \ | |
"-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ | |
-S . -B build | |
cmake --build build | |
cmake --install build | |
cmake --build build --target test_dependencies | |
- name: 'Remill test' | |
shell: 'bash' | |
working-directory: remill/build | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
# Only run test on x64 | |
env CTEST_OUTPUT_ON_FAILURE=1 ctest . | |
- name: 'Anvill build' | |
shell: 'bash' | |
working-directory: anvill | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
cmake -G Ninja \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
"-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ | |
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ | |
-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ | |
-DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \ | |
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \ | |
-DANVILL_ENABLE_TESTS=true \ | |
-DANVILL_ENABLE_INSTALL=true \ | |
-DANVILL_ENABLE_PYTHON3_LIBS=OFF \ | |
"-Dremill_DIR=$(pwd)/../remill/install/lib/cmake/remill" \ | |
"-Dsleigh_DIR=$(pwd)/../remill/install/lib/cmake/sleigh" \ | |
-S . -B build | |
cmake --build build | |
cmake --install build | |
- name: 'Anvill test' | |
shell: 'bash' | |
working-directory: anvill | |
if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') | |
run: | | |
cmake --build build --target test | |
- name: Cache cleanup and reporting | |
shell: 'bash' | |
run: | | |
rm -rf vcpkg/{buildtrees,installed,packages} | |
ccache --show-stats |