Add CI support for macos and linux arm64 #168
Workflow file for this run
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
# 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: Automatic Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
env: | |
node_version: 16 | |
export_cmd: | | |
GIT_TAG=$(echo ${GITHUB_REF#refs/*/} | cut -d 'v' -f 2) | |
PKG_VERSION=$(echo $(node -p "JSON.stringify(require('./package.json').version)") | sed 's|"||g') | |
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV | |
echo "PKG_VERSION=$PKG_VERSION" >> $GITHUB_ENV | |
jobs: | |
quality-gate: | |
name: Quality Gate | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Count lines of code (CLOC) 📐 | |
uses: djdefi/cloc-action@5 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: "CLOC" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check ratCheck ✅ | |
uses: fountainhead/[email protected] | |
id: rat-check | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Rat Check" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check Scala format ✅ | |
uses: fountainhead/[email protected] | |
id: scala-format | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Scala code is properly formatted" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check TypeScript format ✅ | |
uses: fountainhead/[email protected] | |
id: ts-format | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "TypeScript code is properly formatted" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check tests - macOS 12 ✅ | |
uses: fountainhead/[email protected] | |
id: macos12-tests | |
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-12 🔧" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check tests - macOS 14 ✅ | |
uses: fountainhead/[email protected] | |
id: macos14-tests | |
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-14 🔧" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check tests - Linux ✅ | |
uses: fountainhead/[email protected] | |
id: ubuntu-tests | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Build middleware ubuntu-20.04 🔧" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check tests - Windows ✅ | |
uses: fountainhead/[email protected] | |
id: windows-tests | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Build middleware windows-2019 🔧" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check native build arm64 - Linux ✅ | |
uses: fountainhead/[email protected] | |
id: ubuntu-arm64-native | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Native build ubuntu-20.04 arm64 🦙" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Quality Gate ✅ | |
if: | | |
steps.rat-check.outputs.conclusion != 'success' || | |
steps.scala-format.outputs.conclusion != 'success' || | |
steps.ts-format.outputs.conclusion != 'success' || | |
steps.macos12-tests.outputs.conclusion != 'success' || | |
steps.macos14-tests.outputs.conclusion != 'success' || | |
steps.ubuntu-tests.outputs.conclusion != 'success' || | |
steps.ubuntu-arm64-native.outputs.conclusion != 'success' || | |
steps.windows-tests.outputs.conclusion != 'success' | |
run: | | |
echo "Rat Check Status: ${{ steps.rat-check.conclusion }}" | |
echo "Scala Format Status: ${{ steps.scala-format.conclusion }}" | |
echo "Typescript Format Status: ${{ steps.ts-format.conclusion }}" | |
echo "MacOS Test Status: ${{ steps.macos-tests.conclusion }}" | |
echo "Ubuntu Test Status: ${{ steps.ubuntu-tests.conclusion }}" | |
echo "Windows Test Status: ${{ steps.windows-tests.conclusion }}" | |
false | |
create-release: | |
name: Create Release ✨ | |
needs: [quality-gate] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Export git tag and package.json version 🚢 | |
run: ${{ env.export_cmd }} | |
- name: Check if pre-release ✅ | |
run: | | |
if [[ ${{ env.GIT_TAG }} == *"pre-"* || ${{ env.GIT_TAG }} == *"-pre"* ]]; then | |
echo "PRE_RELEASE=true" >> $GITHUB_ENV | |
else | |
echo "PRE_RELEASE=false" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Create release 🔧 | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: false | |
prerelease: "${{ env.PRE_RELEASE }}" | |
- name: Create upload_url file 🔧 | |
run: echo "${{ steps.create_release.outputs.upload_url }}" > upload_url | |
- name: Upload upload_url 🔺 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: upload_url | |
path: upload_url | |
scala-publish: | |
needs: [create-release] | |
name: Scala Publish API, Native and Server✨ | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Export git tag and package.json version 🚢 | |
run: ${{ env.export_cmd }} | |
shell: bash | |
- name: Download upload_url 🔻 | |
uses: actions/download-artifact@v4 | |
with: | |
name: upload_url | |
- name: Add upload_url to GITHUB_ENV | |
run: | | |
UPLOAD_URL=$(cat upload_url) | |
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV | |
- name: Setup Java ☕ | |
uses: actions/[email protected] | |
with: | |
distribution: temurin | |
java-version: 8 | |
cache: sbt | |
- name: Make _install directory to store lib files | |
run: mkdir -p _install | |
- name: Download linux x86 library file 🔻 | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: tests.yml | |
branch: arm64-ci-support #main | |
workflow_conclusion: success | |
name: ubuntu-20.04-x64-libomega_edit.so | |
path: _install/libomega_edit_linux_amd64.so | |
- name: Download linux arm64 library file 🔻 | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: tests.yml | |
branch: arm64-ci-support #main | |
workflow_conclusion: success | |
name: ubuntu-20.04-arm64-libomega_edit.so | |
path: _install/libomega_edit_linux_aarch64.so | |
- name: Download macos-12 library file 🔻 | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: tests.yml | |
branch: arm64-ci-support #main | |
workflow_conclusion: success | |
name: macos-14-arm64-libomega_edit.dylib | |
path: _install/libomega_edit_macos_aarch64.dylib | |
- name: Download macos-14 library file 🔻 | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: tests.yml | |
branch: arm64-ci-support #main | |
workflow_conclusion: success | |
name: macos-12-x64-libomega_edit.dylib | |
path: _install/libomega_edit_macos_x86_64.dylib | |
- name: Download windows library file 🔻 | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: tests.yml | |
branch: arm64-ci-support #main | |
workflow_conclusion: success | |
name: omega_edit.dll | |
path: _install/omega_edit_windows_64.dll | |
- name: Move out library files 🛻 | |
run: | | |
for lib_filename in \ | |
"libomega_edit_linux_amd64.so" \ | |
"libomega_edit_linux_aarch64.so" \ | |
"libomega_edit_macos_x86_64.dylib" \ | |
"libomega_edit_macos_aarch64.dylib" \ | |
"omega_edit_windows_64.dll" | |
do | |
downloaded_filename=$(echo $lib_filename \ | |
| sed "s|_linux_amd64||g" \ | |
| sed "s|_linux_aarch64||g" \ | |
| sed "s|_macos_x86_64||g" \ | |
| sed "s|_macos_aarch64||g" \ | |
| sed "s|_windows_64||g" | |
) | |
mv -v "${lib_filename}" "${lib_filename}_dir" | |
mv -v "${lib_filename}_dir/$downloaded_filename" "$lib_filename" | |
rm -rf "${lib_filename}_dir" | |
done | |
working-directory: _install | |
shell: bash | |
########################### | |
## Scala publish process ## | |
########################### | |
- name: Package Scala Native 🎁 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IS_RELEASE: true | |
run: sbt native/publish | |
working-directory: server/scala | |
- name: Package Scala API 🎁 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IS_RELEASE: true | |
run: sbt api/publish | |
working-directory: server/scala | |
- name: Package Scala RPC server 🎁 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IS_RELEASE: true | |
SERVER_RELEASE: true | |
run: | | |
rm -rf ~/.m2/repository | |
sbt serv/Universal/packageBin | |
working-directory: server/scala | |
shell: bash | |
- name: Fix folder name for Scala RPC server 🔧 | |
run: | | |
mv -v \ | |
server/scala/serv/target/universal/omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip \ | |
omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
- name: Upload Scala RPC server - Not Release 🔺 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
path: omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
- name: Upload Scala RPC server - Release 🔺 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
asset_path: ./omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
asset_name: omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
asset_content_type: application/tar+gzip | |
node-build: | |
name: Node Release ✨ | |
runs-on: ubuntu-20.04 # NOTE: build on older OS versions to support older OS versions | |
needs: [scala-publish] | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Export git tag and package.json version 🚢 | |
run: ${{ env.export_cmd }} | |
- name: Download upload_url 🔻 | |
uses: actions/download-artifact@v4 | |
with: | |
name: upload_url | |
- name: Add upload_url to GITHUB_ENV 📐 | |
run: | | |
UPLOAD_URL=$(cat upload_url) | |
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV | |
########################## | |
## Node release process ## | |
########################## | |
- name: Setup Node 📐 | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
node-version: ${{ env.node_version }} | |
- name: Download scala release file 🔻 | |
uses: actions/download-artifact@v4 | |
with: | |
name: omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
path: omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip | |
- name: Extract scala server file 🛻 | |
run: | | |
scala_pkg_file="omega-edit-grpc-server-${{ env.PKG_VERSION }}.zip" | |
mv -v "${scala_pkg_file}" "${scala_pkg_file}_dir" | |
mv -v "${scala_pkg_file}_dir/${scala_pkg_file}" "${scala_pkg_file}" | |
rm -rf "${scala_pkg_file}_dir" | |
mkdir -p server/scala/serv/target/universal || true | |
mv "$scala_pkg_file" "server/scala/serv/target/universal/$scala_pkg_file" | |
- name: Create server and client package tarball file 🔧 | |
run: | | |
yarn | |
yarn package-no-sbt # create both client and server package | |
- name: Upload node server release tarball 🔺 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
asset_path: ./packages/server/omega-edit-node-server-v${{ env.PKG_VERSION }}.tgz | |
asset_name: omega-edit-node-server-v${{ env.PKG_VERSION }}.tgz | |
asset_content_type: application/tar+gzip | |
- name: Upload node client release tarball 🔺 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
asset_path: ./packages/client/omega-edit-node-client-v${{ env.PKG_VERSION }}.tgz | |
asset_name: omega-edit-node-client-v${{ env.PKG_VERSION }}.tgz | |
asset_content_type: application/tar+gzip | |
- name: Publish server node package to npm registry 🚀 | |
run: yarn publish -f --access=public | |
working-directory: packages/server/out | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
if: ${{ contains(github.event.head_commit.message, '[node_publish]') }} | |
- name: Publish client node package to npm registry 🚀 | |
run: yarn publish -f --access=public | |
working-directory: packages/client/out | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
if: ${{ contains(github.event.head_commit.message, '[node_publish]') }} |