CI build static linux arm64 #176
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: build | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
env: | |
version_in_development: v1.2.0 | |
jobs: | |
draft-release: | |
permissions: | |
contents: write | |
name: Draft Release if develop branch | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.draft_release.outputs.upload_url }} | |
release_id: ${{ steps.draft_release.outputs.id }} | |
steps: | |
- name: Create Release | |
id: draft_release | |
if: github.head_ref == 'develop' || github.head_ref == 'feature/aarm64-release' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
owner: tipi-build | |
repo: goldilock | |
commitish: ${{ github.sha }} | |
tag_name: ${{ env.version_in_development }} | |
release_name: ${{ env.version_in_development }} ${{ github.sha }} | |
draft: true | |
prerelease: true | |
# build-macos: | |
# name: build-macos | |
# runs-on: macos-latest | |
# permissions: | |
# contents: write | |
# needs: draft-release | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: install and build | |
# run: | | |
# cmake -S . -B build/macos -DCMAKE_TOOLCHAIN_FILE=environments/macos-clang-cxx17.cmake -DCMAKE_BUILD_TYPE=Release | |
# cmake --build build/macos | |
# cd build/macos/ && cpack -G ZIP | |
# - name: Upload goldilock package | |
# if: ${{needs.draft-release.outputs.upload_url}} | |
# id: upload-tipi-goldilock-package | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{needs.draft-release.outputs.upload_url}} | |
# asset_path: ./build/macos/goldilock.zip | |
# asset_name: goldilock-macos.zip | |
# asset_content_type: application/zip | |
# - name: Run tests | |
# run: | | |
# cd build/macos/ | |
# ctest --verbose -E test_docker | |
# | |
# build-macos-intel: | |
# name: build-macos-intel | |
# runs-on: macos-13 | |
# permissions: | |
# contents: write | |
# needs: draft-release | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: install and build | |
# run: | | |
# cmake -S . -B build/macos -DCMAKE_TOOLCHAIN_FILE=environments/macos-clang-cxx17.cmake -DCMAKE_BUILD_TYPE=Release | |
# cmake --build build/macos | |
# cd build/macos/ | |
# cpack -G ZIP | |
# - name: Upload goldilock package | |
# if: ${{needs.draft-release.outputs.upload_url}} | |
# id: upload-tipi-goldilock-package | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{needs.draft-release.outputs.upload_url}} | |
# asset_path: ./build/macos/goldilock.zip | |
# asset_name: goldilock-macos-intel.zip | |
# asset_content_type: application/zip | |
# - name: Run tests | |
# run: | | |
# | |
# cd build/macos/ | |
# ctest --verbose -E test_docker | |
build-linux: | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-22.04-arm] | |
runs-on: ${{ matrix.os }} | |
name: build-linux-${{ matrix.os }} | |
permissions: | |
contents: write | |
needs: draft-release | |
steps: | |
- uses: actions/checkout@v2 | |
- name: setup | |
run: | | |
# we need ninja | |
sudo apt update | |
sudo apt-get install -y ninja-build | |
sudo docker --version | |
sudo docker buildx version | |
- name: compute build folder | |
run: | | |
echo "BUILD_ARCHITECTURE=$(uname -i)" >> $GITHUB_ENV | |
echo "BUILD_FOLDER=build/linux_$(uname -i)" >> $GITHUB_ENV | |
- name: install and build | |
run: | | |
cmake -S . -B $BUILD_FOLDER -GNinja -DCMAKE_TOOLCHAIN_FILE=environments/linux-system-clang-cxx17-static.cmake -DCMAKE_BUILD_TYPE=Release | |
cmake --build $BUILD_FOLDER | |
cd $BUILD_FOLDER | |
cpack -G ZIP | |
- name: Upload goldilock package | |
if: ${{needs.draft-release.outputs.upload_url}} | |
id: upload-tipi-goldilock-package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{needs.draft-release.outputs.upload_url}} | |
asset_path: ${{ env.BUILD_FOLDER }}/goldilock.zip | |
asset_name: goldilock-linux-${{ env.BUILD_ARCHITECTURE }}.zip | |
asset_content_type: application/zip | |
- name: Check static link | |
run: | | |
cd $BUILD_FOLDER | |
set +e | |
ldd src/goldilock | |
set -e | |
- name: Run tests | |
run: | | |
cd $BUILD_FOLDER | |
ctest --verbose -E test_docker | |
- name: Run docker tests | |
run: | | |
# we will use this to be able to map the docker-in-docker paths between | |
# this environment and the containers the tests will run | |
export SHARE_VOLUME_FOLDER=_dind_shared_volume | |
export GOLDILOCK_TEST_DIND_SHARED_VOLUME_CONTAINER=${{ github.workspace }}/$SHARE_VOLUME_FOLDER | |
export GOLDILOCK_TEST_DIND_SHARED_VOLUME_HOST=${{ github.workspace }}/$SHARE_VOLUME_FOLDER | |
export GOLDILOCK_TEST_DIND_SHARED_VOLUME_TEST=$(pwd)/$SHARE_VOLUME_FOLDER | |
# create the folder from the test environmnent's perspective: | |
mkdir -p $GOLDILOCK_TEST_DIND_SHARED_VOLUME_TEST | |
echo "hello" > $GOLDILOCK_TEST_DIND_SHARED_VOLUME_TEST/test_from_ci_yaml | |
cd $BUILD_FOLDER | |
# ... we need priviledge to write to the docker socket | |
sudo --preserve-env ctest --verbose -R test_docker |