Test suite for goldilock #129
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.1.0 | |
jobs: | |
draft-release: | |
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' | |
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 | |
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 | |
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: | |
name: build-linux | |
runs-on: ubuntu-latest | |
container: | |
image: tipibuild/tipi-ubuntu:latest | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
# --init makes sure the container has an init process running as as the PID 1 in the container. Specifying an init process ensures the usual responsibilities of an init system, such as reaping zombie processes, are performed inside the created container. | |
options: --init | |
needs: draft-release | |
steps: | |
- uses: actions/checkout@v2 | |
- name: setup | |
run: | | |
sudo apt update | |
sudo apt-get install -y docker.io | |
# the buildx plugin is available under either one of these names | |
set +e | |
sudo apt-get install -y docker-buildx | |
sudo apt-get install -y docker-buildx-plugin | |
set -e | |
sudo docker --version | |
sudo docker buildx version | |
- name: install and build | |
run: | | |
tipi run cmake -S . -B build/linux -GNinja -DCMAKE_TOOLCHAIN_FILE=environments/linux-clang-cxx17-static.cmake -DCMAKE_BUILD_TYPE=Release | |
tipi run cmake --build build/linux | |
cd build/linux/ | |
tipi run 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/linux/goldilock.zip | |
asset_name: goldilock-linux.zip | |
asset_content_type: application/zip | |
- name: Run tests | |
run: | | |
cd build/linux/ | |
tipi run 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 GOLDILOCK_TEST_DIND_SHARED_VOLUME_CONTAINER=${{ github.workspace }}/_dind_shared_volume | |
export GOLDILOCK_TEST_DIND_SHARED_VOLUME_HOST=${{ github.workspace }}/_dind_shared_volume | |
export GOLDILOCK_TEST_DIND_SHARED_VOLUME_TEST=$(pwd)/_dind_shared_volume | |
env | |
echo "---------------" | |
echo $GOLDILOCK_TEST_DIND_SHARED_VOLUME_HOST | |
echo "---------------" | |
pwd | |
echo "---------------" | |
mkdir -p $GOLDILOCK_TEST_DIND_SHARED_VOLUME_HOST | |
echo "hello" > $GOLDILOCK_TEST_DIND_SHARED_VOLUME_HOST/test_from_ci_yaml | |
cd build/linux/ | |
# ... we need priviledge to write to the docker socket | |
sudo --preserve-env tipi run ctest --verbose -R test_docker |