Skip to content

Commit c0416b4

Browse files
authored
Add CI support for macos and linux arm64 (#878)
- 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
1 parent 483c20a commit c0416b4

File tree

9 files changed

+512
-153
lines changed

9 files changed

+512
-153
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright (c) 2021 Concurrent Technologies Corporation.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
4+
# with the License. You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software is distributed under the License is
9+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10+
# implied. See the License for the specific language governing permissions and limitations under the License.
11+
12+
---
13+
name: Build Middleware
14+
description: Reusable action for building middleware code using docker
15+
inputs:
16+
os-name:
17+
description: 'OS Name (runs-on value)'
18+
required: true
19+
docker-image:
20+
description: 'Docker image to use'
21+
required: true
22+
library-filename:
23+
description: 'Filename of library file (libomega_edit.so, libomega_edit.dylib or omega_edit.dll)'
24+
required: true
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Set up QEMU 🔧
29+
uses: docker/setup-qemu-action@v1
30+
with:
31+
platforms: arm64
32+
33+
- name: Download library file 🔻
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: ${{ inputs.os-name }}-${{ inputs.library-filename }}
37+
path: _install/${{ inputs.library-filename }}
38+
39+
- name: Move out library file 🛻
40+
run: |
41+
mv -v "_install/${{ inputs.library-filename }}" "_install/${{ inputs.library-filename }}_dir"
42+
mv -v "_install/${{ inputs.library-filename }}_dir/${{ inputs.library-filename }}" "_install/${{ inputs.library-filename }}"
43+
rm -rf "_install/${{ inputs.library-filename }}_dir"
44+
shell: bash
45+
46+
- name: Start container 🐳
47+
shell: bash
48+
run: |
49+
docker run \
50+
--memory "8g" \
51+
--cpus "2" \
52+
-d \
53+
--name omega-edit-${{ inputs.os-name }}-cont \
54+
-v $PWD:/omega-edit \
55+
-w /omega-edit \
56+
${{ inputs.docker-image }} \
57+
bash -c "tail -f /dev/null"
58+
59+
- name: Package Scala Native 🎁
60+
shell: bash
61+
run: docker exec -w /omega-edit/server/scala omega-edit-${{ inputs.os-name }}-cont bash -c "sbt installM2"
62+
63+
- name: Test Scala RPC server 📋
64+
shell: bash
65+
run: docker exec -w /omega-edit/server/scala omega-edit-${{ inputs.os-name }}-cont bash -c "sbt serv/test"
66+
67+
- name: Yarn Install 🏗️
68+
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "yarn install"
69+
shell: bash
70+
71+
- name: Yarn Package - Server 📦
72+
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "yarn workspace @omega-edit/server package"
73+
shell: bash
74+
75+
- name: Yarn Test - Client 🧑‍💼
76+
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "yarn workspace @omega-edit/client test"
77+
shell: bash
78+
79+
- name: Remove container and image 🧹
80+
shell: bash
81+
if: success() || failure()
82+
run: |
83+
docker kill omega-edit-${{ inputs.os-name }}-cont
84+
docker rm -f omega-edit-${{ inputs.os-name }}-cont
85+
docker rmi -f ${{ inputs.docker-image }}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Copyright (c) 2021 Concurrent Technologies Corporation.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
4+
# with the License. You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software is distributed under the License is
9+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10+
# implied. See the License for the specific language governing permissions and limitations under the License.
11+
12+
---
13+
name: Build Middleware
14+
description: Reusable action to build omega-edit middleware
15+
inputs:
16+
runner-os:
17+
description: 'OS Name of Runner (macOS, Linux, Windows)'
18+
required: true
19+
os-name:
20+
description: 'OS Name (runs-on value)'
21+
required: true
22+
github-token:
23+
description: 'GitHub token retrieved from secrets'
24+
required: true
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Checkout 🛎️
29+
uses: actions/checkout@v4
30+
31+
# NOTE: The macos-14 runner doesn't support JAVA 8, only 11+ can be used.
32+
# macos-14 uses an M1 apple silicon chip, most likely being the reason it can't
33+
# use JAVA 8.
34+
- name: Setup Java 8 - non macos 14 ☕
35+
uses: actions/setup-java@v4.0.0
36+
with:
37+
distribution: temurin
38+
java-version: 8
39+
cache: sbt
40+
if: ${{ !contains(inputs.os-name, 'macos-14') }}
41+
42+
- name: Setup Java 11 - macos 14 ☕
43+
uses: actions/setup-java@v4.0.0
44+
with:
45+
distribution: temurin
46+
java-version: 11
47+
cache: sbt
48+
if: contains(inputs.os-name, 'macos-14')
49+
50+
- name: Install SBT - macos-14 # if macos-13 is added this will done for it as well
51+
shell: bash
52+
run: brew install sbt
53+
if: contains(inputs.os-name, 'macos-14')
54+
55+
- name: Make _install directory to store lib files 🔧
56+
shell: bash
57+
run: mkdir -p _install
58+
59+
- name: Download macOS library file 🔻
60+
uses: actions/download-artifact@v4
61+
if: inputs.runner-os == 'macOS'
62+
with:
63+
name: ${{ inputs.os-name }}-libomega_edit.dylib
64+
path: _install/libomega_edit.dylib
65+
66+
- name: Download Linux library file 🔻
67+
uses: actions/download-artifact@v4
68+
if: inputs.runner-os == 'Linux'
69+
with:
70+
name: ${{ inputs.os-name }}-libomega_edit.so
71+
path: _install/libomega_edit.so
72+
73+
- name: Download Windows library file 🔻
74+
uses: actions/download-artifact@v4
75+
if: inputs.runner-os == 'Windows'
76+
with:
77+
name: omega_edit.dll
78+
path: _install/omega_edit.dll
79+
80+
- name: Move out library file 🛻
81+
run: |
82+
if [[ ${{ inputs.runner-os }} == 'Linux' ]]; then
83+
LIB_FILENAME="libomega_edit.so"
84+
elif [[ ${{ inputs.runner-os }} == 'macOS' ]]; then
85+
LIB_FILENAME="libomega_edit.dylib"
86+
else
87+
LIB_FILENAME="omega_edit.dll"
88+
fi
89+
90+
mv -v "_install/${LIB_FILENAME}" "_install/${LIB_FILENAME}_dir"
91+
mv -v "_install/${LIB_FILENAME}_dir/$LIB_FILENAME" "_install/$LIB_FILENAME"
92+
rm -rf "_install/${LIB_FILENAME}_dir"
93+
shell: bash
94+
95+
- name: Check Scala headers ✔️
96+
shell: bash
97+
run: sbt headerCheckAll
98+
working-directory: server/scala
99+
100+
- name: Package Scala API - Non windows 🎁
101+
shell: bash
102+
run: sbt installM2 # runs test so specifically running sbt test not needed # TODO: Make sure tests run on windows
103+
if: inputs.runner-os != 'Windows'
104+
working-directory: server/scala
105+
# timeout-minutes: 30
106+
107+
- name: Package Scala Native - Windows 🎁
108+
shell: bash
109+
env:
110+
GITHUB_TOKEN: ${{ inputs.github-token }}
111+
if: inputs.runner-os == 'Windows' # TODO: Remove, current workaround so we can download all OS jars from tests for release
112+
run: sbt native/publishM2
113+
working-directory: server/scala
114+
115+
# - name: Archive M2 🔺
116+
# uses: actions/upload-artifact@v4
117+
# if: success() || failure()
118+
# with:
119+
# name: ${{ inputs.os-name }}-artifacts
120+
# path: ~/.m2/repository/com/ctc/*
121+
# if-no-files-found: error
122+
123+
- name: Test Scala RPC server 📋
124+
shell: bash
125+
run: sbt serv/test
126+
if: inputs.runner-os != 'Windows' # TODO: Make sure tests run on windows
127+
working-directory: server/scala
128+
# timeout-minutes: 30
129+
130+
- name: Yarn Install 🏗️
131+
run: yarn
132+
shell: bash
133+
134+
- name: Yarn Package - Server 📦
135+
if: inputs.runner-os != 'Windows' # TODO: Make sure tests run on windows
136+
run: yarn workspace @omega-edit/server package
137+
shell: bash
138+
# timeout-minutes: 30
139+
140+
- name: Yarn Test - Client 🧑‍💼
141+
if: inputs.runner-os != 'Windows' # TODO: Make sure tests run on windows
142+
run: yarn workspace @omega-edit/client test
143+
shell: bash
144+
# timeout-minutes: 30
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright (c) 2021 Concurrent Technologies Corporation.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
4+
# with the License. You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software is distributed under the License is
9+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10+
# implied. See the License for the specific language governing permissions and limitations under the License.
11+
12+
---
13+
name: Build Native
14+
description: Reusable action for building native code using docker
15+
inputs:
16+
os-name:
17+
description: 'OS Name (runs-on value)'
18+
required: true
19+
docker-image:
20+
description: 'Docker image to use'
21+
required: true
22+
library-filename:
23+
description: 'Filename of library file (libomega_edit.so, libomega_edit.dylib or omega_edit.dll)'
24+
required: true
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Set up QEMU 🔧
29+
uses: docker/setup-qemu-action@v1
30+
with:
31+
platforms: arm64
32+
33+
- name: Start container 🐳
34+
shell: bash
35+
run: |
36+
docker run \
37+
--memory "12g" \
38+
--cpus "3" \
39+
-d \
40+
--name omega-edit-${{ inputs.os-name }}-cont \
41+
-v $PWD:/omega-edit \
42+
-w /omega-edit \
43+
${{ inputs.docker-image }} \
44+
bash -c "tail -f /dev/null"
45+
46+
- name: Perform cmake operators 🔧
47+
shell: bash
48+
run: docker exec omega-edit-${{ inputs.os-name }}-cont bash -c "(make clean || true) && make TYPE=Release all"
49+
50+
- name: Copy library file from docker container 🔻
51+
shell: bash
52+
run: |
53+
rm -rf _install/lib/ || true
54+
mkdir -p _install/lib || true
55+
docker cp \
56+
omega-edit-${{ inputs.os-name }}-cont:/omega-edit/lib/${{ inputs.library-filename }} \
57+
${{ inputs.library-filename }}
58+
59+
- name: Upload Native library 🔺
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: ${{ inputs.os-name }}-${{ inputs.library-filename }}
63+
path: ${{ inputs.library-filename }}
64+
65+
- name: Remove container and image 🧹
66+
shell: bash
67+
if: success() || failure()
68+
run: |
69+
docker kill omega-edit-${{ inputs.os-name }}-cont
70+
docker rm -f omega-edit-${{ inputs.os-name }}-cont
71+
docker rmi -f ${{ inputs.docker-image }}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright (c) 2021 Concurrent Technologies Corporation.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
4+
# with the License. You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software is distributed under the License is
9+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10+
# implied. See the License for the specific language governing permissions and limitations under the License.
11+
12+
---
13+
name: Build Native
14+
description: Reusable action for building native code
15+
inputs:
16+
runner-os:
17+
description: 'OS Name of Runner (macOS, Linux, Windows)'
18+
required: true
19+
os-name:
20+
description: 'OS Name (runs-on value)'
21+
required: true
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Enable Developer Command Prompt 💻
26+
if: inputs.runner-os == 'Windows'
27+
uses: ilammy/msvc-dev-cmd@v1
28+
29+
- name: Setup cmake 🔧
30+
uses: lukka/get-cmake@latest
31+
32+
- name: Prepare, Build, Test, and Install Ωedit™- Non Windows 🔧
33+
if: inputs.runner-os != 'Windows'
34+
shell: bash
35+
run: |
36+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON --install-prefix "${PWD}/_install"
37+
cmake --build build --config Release
38+
ctest -C Release --test-dir build/core --output-on-failure
39+
cmake --install build/packages/core --prefix "${PWD}/_install" --config Release
40+
41+
- name: Prepare, Build, Test, and Install Ωedit™ - Windows 🔧
42+
if: inputs.runner-os == 'Windows'
43+
shell: pwsh
44+
run: |
45+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON --install-prefix "${PWD}/_install"
46+
cmake --build build --config Release
47+
ctest -C Release --test-dir build/core --output-on-failure
48+
cmake --install build/packages/core --prefix "${PWD}/_install" --config Release
49+
50+
- name: Upload Native (.dylib) library - Macos 🔺
51+
uses: actions/upload-artifact@v4
52+
if: inputs.runner-os == 'macOS'
53+
with:
54+
name: ${{ inputs.os-name }}-libomega_edit.dylib
55+
path: _install/lib/libomega_edit.dylib
56+
57+
- name: Upload Native (.so) library - Linux 🔺
58+
uses: actions/upload-artifact@v4
59+
if: inputs.runner-os == 'Linux'
60+
with:
61+
name: ${{ inputs.os-name }}-libomega_edit.so
62+
path: _install/lib/libomega_edit.so
63+
64+
- name: Upload Native (.dll) library - Windows 🔺
65+
uses: actions/upload-artifact@v4
66+
if: inputs.runner-os == 'Windows'
67+
with:
68+
name: omega_edit.dll
69+
path: _install/bin/omega_edit.dll

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818

1919
jobs:
2020
deploy-docs:
21-
runs-on: macos-11
21+
runs-on: macos-12
2222
steps:
2323
- name: Install Prerequisites 📚
2424
run: |

0 commit comments

Comments
 (0)