-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI support for macos and linux arm64
- macos-14 uses an M1 mac so it creates an arm64 library file. - used docker to create the ubuntu-20.04 arm64 image. - took some hacking around to get working, would have worked easier if macos-14 could have been the base os. - but since macos-14 is a VM running on an M1, it doesn't allow nested virtualization. Closes #501
- Loading branch information
Showing
10 changed files
with
531 additions
and
145 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Copyright (c) 2021 Concurrent Technologies Corporation. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software is distributed under the License is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. See the License for the specific language governing permissions and limitations under the License. | ||
|
||
--- | ||
name: Build Middleware | ||
description: Reusable action for building middleware code using docker | ||
inputs: | ||
os-name: | ||
description: 'OS Name (runs-on value)' | ||
required: true | ||
docker-image: | ||
description: 'Docker image to use' | ||
required: true | ||
library-filename: | ||
description: 'Filename of library file (libomega_edit.so, libomega_edit.dylib or omega_edit.dll)' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up QEMU 🔧 | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Download library file 🔻 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.os-name }}-${{ inputs.library-filename }} | ||
path: _install/${{ inputs.library-filename }} | ||
|
||
- name: Move out library file 🛻 | ||
run: | | ||
mv -v "_install/${{ inputs.library-filename }}" "_install/${{ inputs.library-filename }}_dir" | ||
mv -v "_install/${{ inputs.library-filename }}_dir/${{ inputs.library-filename }}" "_install/${{ inputs.library-filename }}" | ||
rm -rf "_install/${{ inputs.library-filename }}_dir" | ||
shell: bash | ||
|
||
- name: Start container 🐳 | ||
shell: bash | ||
run: | | ||
docker run \ | ||
--memory "8g" \ | ||
--cpus "2" \ | ||
-d \ | ||
--name omega-edit-${{ inputs.os-name }}-cont \ | ||
-v $PWD:/omega-edit \ | ||
-w /omega-edit \ | ||
${{ inputs.docker-image }} \ | ||
bash -c "tail -f /dev/null" | ||
- name: Package Scala Native 🎁 | ||
shell: bash | ||
run: docker exec -w /omega-edit/server/scala omega-edit-${{ inputs.os-name }}-cont bash -c "sbt installM2" | ||
|
||
- name: Test Scala RPC server 📋 | ||
shell: bash | ||
run: docker exec -w /omega-edit/server/scala omega-edit-${{ inputs.os-name }}-cont bash -c "sbt serv/test" | ||
|
||
- name: Yarn Install 🏗️ | ||
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "yarn install" | ||
shell: bash | ||
|
||
- name: Yarn Package - Server 📦 | ||
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "yarn workspace @omega-edit/server package" | ||
shell: bash | ||
|
||
- name: Yarn Test - Client 🧑💼 | ||
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "yarn workspace @omega-edit/client test" | ||
shell: bash | ||
|
||
- name: Remove container and image 🧹 | ||
shell: bash | ||
if: success() || failure() | ||
run: | | ||
docker kill omega-edit-${{ inputs.os-name }}-cont | ||
docker rm -f omega-edit-${{ inputs.os-name }}-cont | ||
docker rmi -f ${{ inputs.docker-image }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# Copyright (c) 2021 Concurrent Technologies Corporation. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software is distributed under the License is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. See the License for the specific language governing permissions and limitations under the License. | ||
|
||
--- | ||
name: Build Middleware | ||
description: Reusable action to build omega-edit middleware | ||
inputs: | ||
runner-os: | ||
description: 'OS Name of Runner (macOS, Linux, Windows)' | ||
required: true | ||
os-name: | ||
description: 'OS Name (runs-on value)' | ||
required: true | ||
github-token: | ||
description: 'GitHub token retrieved from secrets' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
|
||
# NOTE: The macos-14 runner doesn't support JAVA 8, only 11+ can be used. | ||
# macos-14 uses an M1 apple silicon chip, most likely being the reason it can't | ||
# use JAVA 8. | ||
- name: Setup Java 8 - non macos 14 ☕ | ||
uses: actions/[email protected] | ||
with: | ||
distribution: temurin | ||
java-version: 8 | ||
cache: sbt | ||
if: ${{ !contains(inputs.os-name, 'macos-14') }} | ||
|
||
- name: Setup Java 11 - macos 14 ☕ | ||
uses: actions/[email protected] | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
cache: sbt | ||
if: contains(inputs.os-name, 'macos-14') | ||
|
||
- name: Install SBT - macos-14 # if macos-13 is added this will done for it as well | ||
shell: bash | ||
run: brew install sbt | ||
if: contains(inputs.os-name, 'macos-14') | ||
|
||
- name: Make _install directory to store lib files 🔧 | ||
shell: bash | ||
run: mkdir -p _install | ||
|
||
- name: Download macOS library file 🔻 | ||
uses: actions/download-artifact@v4 | ||
if: inputs.runner-os == 'macOS' | ||
with: | ||
name: ${{ inputs.os-name }}-libomega_edit.dylib | ||
path: _install/libomega_edit.dylib | ||
|
||
- name: Download Linux library file 🔻 | ||
uses: actions/download-artifact@v4 | ||
if: inputs.runner-os == 'Linux' | ||
with: | ||
name: ${{ inputs.os-name }}-libomega_edit.so | ||
path: _install/libomega_edit.so | ||
|
||
- name: Download Windows library file 🔻 | ||
uses: actions/download-artifact@v4 | ||
if: inputs.runner-os == 'Windows' | ||
with: | ||
name: omega_edit.dll | ||
path: _install/omega_edit.dll | ||
|
||
- name: Move out library file 🛻 | ||
run: | | ||
if [[ ${{ inputs.runner-os }} == 'Linux' ]]; then | ||
LIB_FILENAME="libomega_edit.so" | ||
elif [[ ${{ inputs.runner-os }} == 'macOS' ]]; then | ||
LIB_FILENAME="libomega_edit.dylib" | ||
else | ||
LIB_FILENAME="omega_edit.dll" | ||
fi | ||
mv -v "_install/${LIB_FILENAME}" "_install/${LIB_FILENAME}_dir" | ||
mv -v "_install/${LIB_FILENAME}_dir/$LIB_FILENAME" "_install/$LIB_FILENAME" | ||
rm -rf "_install/${LIB_FILENAME}_dir" | ||
shell: bash | ||
|
||
- name: Check Scala headers ✔️ | ||
shell: bash | ||
run: sbt headerCheckAll | ||
working-directory: server/scala | ||
|
||
- name: Package Scala API - Non windows 🎁 | ||
shell: bash | ||
run: sbt installM2 # runs test so specifically running sbt test not needed # TODO: Make sure tests run on windows | ||
if: inputs.runner-os != 'Windows' | ||
working-directory: server/scala | ||
# timeout-minutes: 30 | ||
|
||
- name: Package Scala Native - Windows 🎁 | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.github-token }} | ||
if: inputs.runner-os == 'Windows' # TODO: Remove, current workaround so we can download all OS jars from tests for release | ||
run: sbt native/publishM2 | ||
working-directory: server/scala | ||
|
||
# - name: Archive M2 🔺 | ||
# uses: actions/upload-artifact@v4 | ||
# if: success() || failure() | ||
# with: | ||
# name: ${{ inputs.os-name }}-artifacts | ||
# path: ~/.m2/repository/com/ctc/* | ||
# if-no-files-found: error | ||
|
||
- name: Test Scala RPC server 📋 | ||
shell: bash | ||
run: sbt serv/test | ||
if: inputs.runner-os != 'Windows' # TODO: Make sure tests run on windows | ||
working-directory: server/scala | ||
# timeout-minutes: 30 | ||
|
||
- name: Yarn Install 🏗️ | ||
run: yarn | ||
shell: bash | ||
|
||
- name: Yarn Package - Server 📦 | ||
if: inputs.runner-os != 'Windows' # TODO: Make sure tests run on windows | ||
run: yarn workspace @omega-edit/server package | ||
shell: bash | ||
# timeout-minutes: 30 | ||
|
||
- name: Yarn Test - Client 🧑💼 | ||
if: inputs.runner-os != 'Windows' # TODO: Make sure tests run on windows | ||
run: yarn workspace @omega-edit/client test | ||
shell: bash | ||
# timeout-minutes: 30 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright (c) 2021 Concurrent Technologies Corporation. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software is distributed under the License is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. See the License for the specific language governing permissions and limitations under the License. | ||
|
||
--- | ||
name: Build Native | ||
description: Reusable action for building native code using docker | ||
inputs: | ||
os-name: | ||
description: 'OS Name (runs-on value)' | ||
required: true | ||
docker-image: | ||
description: 'Docker image to use' | ||
required: true | ||
library-filename: | ||
description: 'Filename of library file (libomega_edit.so, libomega_edit.dylib or omega_edit.dll)' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up QEMU 🔧 | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Start container 🐳 | ||
shell: bash | ||
run: | | ||
docker run \ | ||
--memory "12g" \ | ||
--cpus "3" \ | ||
-d \ | ||
--name omega-edit-${{ inputs.os-name }}-cont \ | ||
-v $PWD:/omega-edit \ | ||
-w /omega-edit \ | ||
${{ inputs.docker-image }} \ | ||
bash -c "tail -f /dev/null" | ||
- name: Perform cmake operators 🔧 | ||
shell: bash | ||
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "(make clean || true) && make TYPE=Release all" | ||
|
||
- name: Copy library file from docker container 🔻 | ||
shell: bash | ||
run: | | ||
rm -rf _install/lib/ || true | ||
mkdir -p _install/lib || true | ||
docker cp \ | ||
omega-edit-${{ inputs.os-name }}-cont:/omega-edit/lib/${{ inputs.library-filename }} \ | ||
${{ inputs.library-filename }} | ||
- name: Upload Native library 🔺 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.os-name }}-${{ inputs.library-filename }} | ||
path: ${{ inputs.library-filename }} | ||
|
||
- name: Remove container and image 🧹 | ||
shell: bash | ||
if: success() || failure() | ||
run: | | ||
docker kill omega-edit-${{ inputs.os-name }}-cont | ||
docker rm -f omega-edit-${{ inputs.os-name }}-cont | ||
docker rmi -f ${{ inputs.docker-image }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Copyright (c) 2021 Concurrent Technologies Corporation. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software is distributed under the License is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. See the License for the specific language governing permissions and limitations under the License. | ||
|
||
--- | ||
name: Build Native | ||
description: Reusable action for building native code | ||
inputs: | ||
runner-os: | ||
description: 'OS Name of Runner (macOS, Linux, Windows)' | ||
required: true | ||
os-name: | ||
description: 'OS Name (runs-on value)' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Enable Developer Command Prompt 💻 | ||
if: inputs.runner-os == 'Windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Setup cmake 🔧 | ||
uses: lukka/get-cmake@latest | ||
|
||
- name: Prepare, Build, Test, and Install Ωedit™- Non Windows 🔧 | ||
if: inputs.runner-os != 'Windows' | ||
shell: bash | ||
run: | | ||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON --install-prefix "${PWD}/_install" | ||
cmake --build build --config Release | ||
ctest -C Release --test-dir build/core --output-on-failure | ||
cmake --install build/packages/core --prefix "${PWD}/_install" --config Release | ||
- name: Prepare, Build, Test, and Install Ωedit™ - Windows 🔧 | ||
if: inputs.runner-os == 'Windows' | ||
shell: pwsh | ||
run: | | ||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON --install-prefix "${PWD}/_install" | ||
cmake --build build --config Release | ||
ctest -C Release --test-dir build/core --output-on-failure | ||
cmake --install build/packages/core --prefix "${PWD}/_install" --config Release | ||
- name: Upload Native (.dylib) library - Macos 🔺 | ||
uses: actions/upload-artifact@v4 | ||
if: inputs.runner-os == 'macOS' | ||
with: | ||
name: ${{ inputs.os-name }}-libomega_edit.dylib | ||
path: _install/lib/libomega_edit.dylib | ||
|
||
- name: Upload Native (.so) library - Linux 🔺 | ||
uses: actions/upload-artifact@v4 | ||
if: inputs.runner-os == 'Linux' | ||
with: | ||
name: ${{ inputs.os-name }}-libomega_edit.so | ||
path: _install/lib/libomega_edit.so | ||
|
||
- name: Upload Native (.dll) library - Windows 🔺 | ||
uses: actions/upload-artifact@v4 | ||
if: inputs.runner-os == 'Windows' | ||
with: | ||
name: omega_edit.dll | ||
path: _install/bin/omega_edit.dll |
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
Oops, something went wrong.