Skip to content

Commit

Permalink
Add arm64 workflows. Split out reusable code into reusable actions.
Browse files Browse the repository at this point in the history
Closes #501
  • Loading branch information
shanedell committed Feb 10, 2024
1 parent 430cd27 commit 28f653b
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 119 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/build-middleware/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# 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
runs:
using: "composite"
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup Java ☕
uses: actions/[email protected]
with:
distribution: temurin
java-version: 8
cache: sbt

- 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
CURRENT_LIB_FILENAME="${{ inputs.runner-os }}-libomega_edit.so"
LIB_FILENAME="libomega_edit.so"
elif [[ ${{ inputs.runner-os }} == 'macOS' ]]; then
CURRENT_LIB_FILENAME="${{ inputs.runner-os }}-libomega_edit.dylib"
LIB_FILENAME="libomega_edit.dylib"
else
CURRENT_LIB_FILENAME="omega_edit.dll"
LIB_FILENAME="omega_edit.dll"
fi
mv -v "_install/${CURRENT_LIB_FILENAME}" "_install/${CURRENT_LIB_FILENAME}_dir"
mv -v "_install/${CURRENT_LIB_FILENAME}_dir/$CURRENT_LIB_FILENAME" "_install/$LIB_FILENAME"
rm -rf "_install/${CURRENT_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: ${{ secrets.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
69 changes: 69 additions & 0 deletions .github/workflows/build-native/action.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

jobs:
deploy-docs:
runs-on: macos-11
runs-on: macos-13
steps:
- name: Install Prerequisites 📚
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
checkName: "Build middleware macos-11 🔧"
checkName: "Build middleware macos-14 🔧"
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Check tests - Linux ✅
Expand Down
Loading

0 comments on commit 28f653b

Please sign in to comment.