v3.3.8 #84
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
name: Build OIBus binaries | |
on: | |
workflow_dispatch: | |
release: | |
types: [ published ] | |
jobs: | |
build-binaries-x64: | |
name: Build for ${{ matrix.config['friendlyName'] }} | |
runs-on: ${{ matrix.config['os'] }} | |
strategy: | |
matrix: | |
config: | |
- { friendlyName: 'MacOS x64', os: 'macos-latest', platform: 'macos', archiveName: 'oibus-macos_x64', zip: 'zip -r' } | |
- { friendlyName: 'Windows x64', os: 'windows-latest', platform: 'win', archiveName: 'oibus-win_x64', zip: '7z a -tzip' } | |
- { friendlyName: 'Linux x64', os: 'ubuntu-latest', platform: 'linux', archiveName: 'oibus-linux_x64', zip: 'zip -r' } | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup shared environment | |
uses: ./.github/actions/setup_shared_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Setup launcher environment | |
uses: ./.github/actions/setup_launcher_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Setup backend environment | |
uses: ./.github/actions/setup_backend_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Setup frontend environment | |
uses: ./.github/actions/setup_frontend_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Bundle OIBus frontend for ${{ matrix.config['friendlyName'] }} | |
working-directory: ./frontend | |
run: npm run build | |
- name: Build OIBus launcher for ${{ matrix.config['friendlyName'] }} | |
working-directory: ./launcher | |
run: npm run build:${{ matrix.config['platform'] }} | |
- name: Build OIBus binary for ${{ matrix.config['friendlyName'] }} | |
working-directory: ./backend | |
run: npm run build:${{ matrix.config['platform'] }} | |
- name: Test OIBus run for ${{ matrix.config['friendlyName'] }} | |
run: | | |
cd build/bin/${{ matrix.config['platform'] }} | |
./oibus-launcher --config ../../../data-folder --check true | |
- name: Package OIBus for ${{ matrix.config['friendlyName'] }} | |
run: | | |
cd build/bin/${{ matrix.config['platform'] }} | |
${{ matrix.config['zip'] }} ../${{ matrix.config['archiveName'] }}-${{ github.ref_name }}.zip . | |
- name: Upload Artifact ${{ matrix.config['archiveName'] }}-${{ github.ref_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
run: | |
gh release upload ${{ github.ref_name }} ./build/bin/${{ matrix.config['archiveName'] }}-${{ github.ref_name }}.zip | |
- name: Package Windows installer | |
env: | |
PFX_PASSWORD: ${{ secrets.PFX_PASSWORD }} | |
PFX_BASE64_CONTENT: ${{ secrets.PFX_BASE64_CONTENT }} | |
PFX_PATH: C://oibus.pfx | |
if: ${{ matrix.config['platform'] == 'win' }} | |
shell: pwsh | |
working-directory: ./backend | |
run: | | |
$encodedBytes = [System.Convert]::FromBase64String("$env:PFX_BASE64_CONTENT") | |
Set-Content -Path "$env:PFX_PATH" -AsByteStream -Value $encodedBytes | |
npm run build:win-setup | |
Remove-Item -Path "$env:PFX_PATH"; | |
- name: Rename windows installer | |
if: ${{ matrix.config['platform'] == 'win' }} | |
run: mv ./build/bin/win-setup-release/oibus-setup.exe ./build/bin/win-setup-release/oibus-setup-win_x64-${{ github.ref_name }}.exe | |
- name: Upload Windows installer Artifact ${{ matrix.config['archiveName'] }} | |
if: ${{ matrix.config['platform'] == 'win' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
run: | |
gh release upload ${{ github.ref_name }} ./build/bin/win-setup-release/oibus-setup-win_x64-${{ github.ref_name }}.exe | |
build-binaries-arm64: | |
name: Build for ${{ matrix.config['friendlyName'] }} | |
runs-on: ${{ matrix.config['os'] }} | |
strategy: | |
matrix: | |
config: | |
- { friendlyName: 'Linux ARM64', os: 'ubuntu-latest', platform: 'linux-arm64', archiveName: 'oibus-linux_arm64', zip: 'zip -r' } | |
timeout-minutes: 440 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup shared environment | |
uses: ./.github/actions/setup_shared_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Setup launcher environment | |
uses: ./.github/actions/setup_launcher_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Setup backend environment | |
uses: ./.github/actions/setup_backend_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Setup frontend environment | |
uses: ./.github/actions/setup_frontend_environment | |
with: | |
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} | |
- name: Bundle OIBus frontend for ${{ matrix.config['friendlyName'] }} | |
working-directory: ./frontend | |
run: npm run build | |
- name: Build OIBus launcher for ${{ matrix.config['friendlyName'] }} | |
working-directory: ./launcher | |
run: npm run build:${{ matrix.config['platform'] }} | |
- name: Pre build OIBus binary for ${{ matrix.config['friendlyName'] }} | |
working-directory: ./backend | |
run: | | |
npm run build | |
npm run internal:build:lib-${{ matrix.config['platform'] }} | |
- name: Run arm64 pkg command | |
uses: uraimo/run-on-arch-action@v2 | |
with: | |
arch: aarch64 | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
# We need to install node and yarn "again" because they don't exist inside our build container | |
install: | | |
apt update && apt -y install curl build-essential | |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - | |
apt-get install -y nodejs | |
npm install -g pkg | |
run: | | |
cd ./backend/ | |
pkg \ | |
--config package.json \ | |
--target=node18-${{ matrix.config['platform'] }} \ | |
--output ../build/bin/${{ matrix.config['platform'] }}/binaries/oibus \ | |
--public --compress GZip \ | |
./dist/backend/src/index.js | |
cd ../launcher | |
pkg \ | |
--config ./package.json \ | |
--target=node18-${{ matrix.config['platform'] }} \ | |
--output ../build/bin/${{ matrix.config['platform'] }}/oibus-launcher \ | |
--public --compress GZip \ | |
./dist/index.js | |
- name: Post build OIBus library for ${{ matrix.config['friendlyName'] }} | |
if: ${{ matrix.config['platform'] == 'linux-arm64' }} | |
run: | | |
stat build/bin/${{ matrix.config['platform'] }}/binaries/oibus | |
sudo cp build/deps/${{ matrix.config['platform'] }}/* ./build/bin/${{ matrix.config['platform'] }}/ | |
cd build/bin/${{ matrix.config['platform'] }} | |
sudo ${{ matrix.config['zip'] }} ../${{ matrix.config['archiveName'] }}-${{ github.ref_name }}.zip . | |
- name: Upload Artifact ${{ matrix.config['archiveName'] }}-${{ github.ref_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
run: | |
gh release upload ${{ github.ref_name }} ./build/bin/${{ matrix.config['archiveName'] }}-${{ github.ref_name }}.zip | |
slack: | |
name: 'Slack notification' | |
needs: [ build-binaries-x64, build-binaries-arm64 ] | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- name: Slack notification | |
uses: kpritam/slack-job-status-action@v1 | |
with: | |
job-status: ${{ needs.build-binaries-x64.result }} | |
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
channel: oibus-ci |