diff --git a/.github/workflows/build-middleware/action.yml b/.github/workflows/build-middleware/action.yml new file mode 100644 index 00000000..69f01221 --- /dev/null +++ b/.github/workflows/build-middleware/action.yml @@ -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/setup-java@v4.0.0 + 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 diff --git a/.github/workflows/build-native/action.yml b/.github/workflows/build-native/action.yml new file mode 100644 index 00000000..9d7aa322 --- /dev/null +++ b/.github/workflows/build-native/action.yml @@ -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 diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 0f490e6d..9d827527 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -18,7 +18,7 @@ on: jobs: deploy-docs: - runs-on: macos-11 + runs-on: macos-13 steps: - name: Install Prerequisites πŸ“š run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6796d692..bb23c918 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 βœ… diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 469a8d93..f8024ba4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,150 +20,88 @@ jobs: build-native: strategy: matrix: - os: [ windows-2019, macos-11, ubuntu-20.04 ] # NOTE: build on older OS versions to support older OS versions + # NOTE: build on older OS versions to support older OS versions + # macos-14 is m1 mac + os: [ windows-2019, macos-13, ubuntu-20.04, macos-14 ] fail-fast: false # don't immediately fail all other jobs if a single job fails name: Native build and test on ${{ matrix.os }} πŸ¦™ runs-on: ${{ matrix.os }} steps: - - name: Enable Developer Command Prompt πŸ’» - if: runner.os == 'Windows' - uses: ilammy/msvc-dev-cmd@v1 - - name: Checkout πŸ›ŽοΈ uses: actions/checkout@v4 - - name: Setup cmake πŸ”§ - uses: lukka/get-cmake@latest - - - name: Prepare, Build, Test, and Install Ξ©editβ„’ πŸ”§ + - name: Convert runner arch to lower + 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 + echo "runner_arch=$(echo $RUNNER_ARCH | awk '{print tolower($0)}')" >> $GITHUB_ENV - - name: Upload Native (.dylib) library - Macos πŸ”Ί - uses: actions/upload-artifact@v4 - if: runner.os == 'macOS' + - name: Build Native ${{ matrix.os }} + uses: ./.github/workflows/build-native with: - name: libomega_edit.dylib - path: _install/lib/libomega_edit.dylib + runner-os: ${{ runner.os }} + os-name: ${{ matrix.os }}-${{ env.runner_arch }} - - name: Upload Native (.so) library - Linux πŸ”Ί - uses: actions/upload-artifact@v4 - if: runner.os == 'Linux' - with: - name: libomega_edit.so - path: _install/lib/libomega_edit.so + build-native-linux-arm64: + name: Native build and test on macos-14 - linux container πŸ¦™ + runs-on: macos-14 + container: ubuntu:20.04 + steps: + - name: Checkout πŸ›ŽοΈ + uses: actions/checkout@v4 - - name: Upload Native (.dll) library - Windows πŸ”Ί - uses: actions/upload-artifact@v4 - if: runner.os == 'Windows' + - name: Convert runner arch to lower + shell: bash + run: | + echo "runner_arch=$(echo $RUNNER_ARCH | awk '{print tolower($0)}')" >> $GITHUB_ENV + + - name: Build Native ${{ matrix.os }} + uses: ./.github/workflows/build-native with: - name: omega_edit.dll - path: _install/bin/omega_edit.dll + runner-os: "Linux" + os-name: "ubuntu-20.04-${{ env.runner_arch }}" build-middleware: needs: [ build-native ] strategy: matrix: - os: [ macos-11, ubuntu-20.04, windows-2019 ] + # NOTE: build on older OS versions to support older OS versions + # macos-14 is m1 mac + os: [ windows-2019, macos-13, ubuntu-20.04, macos-14 ] fail-fast: false runs-on: ${{ matrix.os }} name: Build middleware ${{ matrix.os }} πŸ”§ steps: - name: Checkout πŸ›ŽοΈ uses: actions/checkout@v4 - - - name: Setup Java β˜• - uses: actions/setup-java@v4.0.0 - with: - distribution: temurin - java-version: 8 - cache: sbt - - - name: Make _install directory to store lib files πŸ”§ - run: mkdir -p _install - - - name: Download macOS library file πŸ”» - uses: actions/download-artifact@v4 - if: runner.os == 'macOS' - with: - name: libomega_edit.dylib - path: _install/libomega_edit.dylib - - - name: Download Linux library file πŸ”» - uses: actions/download-artifact@v4 - if: runner.os == 'Linux' - with: - name: libomega_edit.so - path: _install/libomega_edit.so - - - name: Download Windows library file πŸ”» - uses: actions/download-artifact@v4 - if: runner.os == 'Windows' - with: - name: omega_edit.dll - path: _install/omega_edit.dll - - - name: Move out library file πŸ›» - run: | - if [[ ${{ runner.os }} == 'Linux' ]]; then - LIB_FILENAME="libomega_edit.so" - elif [[ ${{ 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" + + - name: Convert runner arch to lower shell: bash + run: | + echo "runner_arch=$(echo $RUNNER_ARCH | awk '{print tolower($0)}')" >> $GITHUB_ENV - - name: Check Scala headers βœ”οΈ - run: sbt headerCheckAll - working-directory: server/scala - - - name: Package Scala API - Non windows 🎁 - run: sbt installM2 # runs test so specifically running sbt test not needed # TODO: Make sure tests run on windows - if: runner.os != 'Windows' - working-directory: server/scala - timeout-minutes: 30 - - - name: Package Scala Native - Windows 🎁 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: 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() + - name: Build Middleware ${{ matrix.os }} + uses: ./.github/workflows/build-middleware with: - name: ${{ matrix.os }}-artifacts - path: ~/.m2/repository/com/ctc/* - if-no-files-found: error - - - name: Test Scala RPC server πŸ“‹ - run: sbt serv/test - if: runner.os != 'Windows' # TODO: Make sure tests run on windows - working-directory: server/scala - timeout-minutes: 30 - - - name: Yarn Install πŸ—οΈ - run: yarn - shell: bash + runner-os: ${{ runner.os }} + os-name: ${{ matrix.os }}-${{ env.runner_arch }} + + build-middleware-linux-arm64: + needs: [ build-native-linux-arm64 ] + name: Build middleware on macos-14 - linux container πŸ¦™ + runs-on: macos-14 + container: ubuntu:20.04 + steps: + - name: Checkout πŸ›ŽοΈ + uses: actions/checkout@v4 - - name: Yarn Package - Server πŸ“¦ - if: runner.os != 'Windows' # TODO: Make sure tests run on windows - run: yarn workspace @omega-edit/server package + - name: Convert runner arch to lower shell: bash - timeout-minutes: 30 + run: | + echo "runner_arch=$(echo $RUNNER_ARCH | awk '{print tolower($0)}')" >> $GITHUB_ENV - - name: Yarn Test - Client πŸ§‘β€πŸ’Ό - if: runner.os != 'Windows' # TODO: Make sure tests run on windows - run: yarn workspace @omega-edit/client test - shell: bash - timeout-minutes: 30 + - name: Build Middleware ${{ matrix.os }} + uses: ./.github/workflows/build-middleware + with: + runner-os: "Linux" + os-name: "ubuntu-20.04-${{ env.runner_arch }}" + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7aea9e3b..16f5c838 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ _build*/ _install _install*/ build*/ +!.github/workflows/build-middleware +!.github/workflows/build-native cmake-build*/ core/src/include/omega-edit/features.h node_modules/ @@ -55,6 +57,8 @@ package-lock.json **/.vscode/settings.json .metals +.bloop +metals.sbt .scala-build project !server/scala/project