Skip to content

Replace old deprecated code with new style #859

Replace old deprecated code with new style

Replace old deprecated code with new style #859

Workflow file for this run

name: Build and Test
on:
push:
branches:
- master
pull_request:
branches:
- master
- dev
workflow_dispatch:
inputs:
release:
description: 'Make release'
jobs:
setup:
name: Set up
runs-on: ubuntu-20.04
outputs:
VERSION: ${{ steps.setup.outputs.VERSION }}
DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }}
steps:
- name: Set up environment variables
id: setup
shell: bash
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
DOING_RELEASE=$(echo $VERSION | grep -c '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true)
echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT
echo $VERSION
echo $DOING_RELEASE
build:
name: Building on ${{ matrix.build }}-${{ matrix.runtime_library }}
runs-on: ${{ matrix.os }}
needs: [ setup ]
strategy:
fail-fast: false
matrix:
include:
- build: linux-amd64
os: ubuntu-20.04
runtime_library: ovmwasm
artifact_name: 'onyx-linux-ovm-amd64'
- build: linux-amd64
os: ubuntu-20.04
runtime_library: wasmer
artifact_name: 'onyx-linux-wasmer-amd64'
- build: linux-amd64
os: ubuntu-20.04
runtime_library: none
artifact_name: 'onyx-linux-none-amd64'
- build: linux-arm64
os: ubuntu-20.04
runtime_library: ovmwasm
artifact_name: 'onyx-linux-ovm-arm64'
- build: linux-arm64
os: ubuntu-20.04
runtime_library: wasmer
artifact_name: 'onyx-linux-wasmer-arm64'
- build: linux-arm64
os: ubuntu-20.04
runtime_library: none
artifact_name: 'onyx-linux-none-arm64'
- build: darwin-arm64
os: macos-12
runtime_library: none
target: aarch64-apple-darwin
artifact_name: 'onyx-darwin-none-arm64'
- build: darwin-arm64
os: macos-12
runtime_library: wasmer
target: aarch64-apple-darwin
artifact_name: 'onyx-darwin-wasmer-arm64'
- build: darwin-amd64
os: macos-12
runtime_library: none
artifact_name: 'onyx-darwin-none-amd64'
- build: darwin-amd64
os: macos-12
runtime_library: wasmer
artifact_name: 'onyx-darwin-wasmer-amd64'
- build: darwin-amd64
os: macos-12
runtime_library: ovmwasm
artifact_name: 'onyx-darwin-ovm-amd64'
- build: darwin-arm64
os: macos-12
runtime_library: ovmwasm
target: aarch64-apple-darwin
artifact_name: 'onyx-darwin-ovm-arm64'
- build: windows-amd64
os: windows-latest
artifact_name: 'onyx-windows-wasmer-amd64'
steps:
- uses: actions/checkout@v3
- name: Setup directory for building
if: matrix.build != 'windows-amd64'
run: |
chmod +x build.sh
- name: Install Wasmer building dependencies (AMD64)
if: (matrix.runtime_library == 'wasmer') && (matrix.build != 'darwin-arm64' && matrix.build != 'linux-arm64')
run: |
curl https://get.wasmer.io -sSfL | sh
echo "$HOME/.wasmer/bin" >> $GITHUB_PATH
# Have to do MacOS ARM64 special, since I don't want to pay for the M1 GitHub runners
# to build this natively. Instead, we directly download the ARM version of WASMER
# and link to its libwasmer.a file.
- name: Install Wasmer building dependencies (LINUX-ARM64)
if: (matrix.runtime_library == 'wasmer') && (matrix.build == 'linux-arm64')
run: |
curl -o wasmer.tar.gz https://github.com/wasmerio/wasmer/releases/download/v4.2.6/wasmer-linux-aarch64.tar.gz -L
mkdir wasmer
tar -C wasmer -zxvf wasmer.tar.gz
# Have to do MacOS ARM64 special, since I don't want to pay for the M1 GitHub runners
# to build this natively. Instead, we directly download the ARM version of WASMER
# and link to its libwasmer.a file.
- name: Install Wasmer building dependencies (DARWIN-ARM64)
if: (matrix.runtime_library == 'wasmer') && (matrix.build == 'darwin-arm64')
run: |
curl -o wasmer.tar.gz https://github.com/wasmerio/wasmer/releases/download/v4.2.6/wasmer-darwin-arm64.tar.gz -L
mkdir wasmer
tar -C wasmer -zxvf wasmer.tar.gz
- name: Install Windows building dependencies
if: matrix.build == 'windows-amd64'
uses: ilammy/msvc-dev-cmd@v1
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-amd64') && (matrix.runtime_library != 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: linux_x86_64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
ONYX_USE_DYNCALL: '1'
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-amd64') && (matrix.runtime_library == 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: linux_x86_64
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-arm64') && (matrix.runtime_library != 'none')
run: |
sudo apt install --yes gcc-aarch64-linux-gnu
./build.sh compile compress
env:
ONYX_CC: aarch64-linux-gnu-gcc
ONYX_ARCH: linux_aarch64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
WASMER_LIB_PATH: ../wasmer/lib
ONYX_USE_DYNCALL: '0'
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-arm64') && (matrix.runtime_library == 'none')
run: |
sudo apt install --yes gcc-aarch64-linux-gnu
./build.sh compile compress
env:
ONYX_CC: aarch64-linux-gnu-gcc
ONYX_ARCH: linux_aarch64
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-amd64') && (matrix.runtime_library != 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_amd64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-amd64') && (matrix.runtime_library == 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_amd64
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'wasmer')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_arm64
ONYX_TARGET: aarch64-apple-darwin
WASMER_LIB_PATH: ../wasmer/lib
ONYX_RUNTIME_LIBRARY: wasmer
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'ovmwasm')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_arm64
ONYX_TARGET: aarch64-apple-darwin
ONYX_RUNTIME_LIBRARY: ovmwasm
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_arm64
ONYX_TARGET: aarch64-apple-darwin
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: matrix.build == 'windows-amd64'
run: |
cmd.exe /c 'build.bat dist'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact_name }}
path: dist
if-no-files-found: error
retention-days: 5
# test:
# needs: [setup, build]
# runs-on: ubuntu-latest
# steps:
# - name: Download artifacts
release:
needs: [setup, build]
runs-on: ubuntu-latest
if: needs.setup.outputs.DOING_RELEASE == '1' || github.event.inputs.release != ''
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.VERSION }}
release_name: Release ${{ needs.setup.outputs.VERSION }}
draft: true
prerelease: false
- name: Upload Release Asset Linux AMD64 with OVM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-ovm-amd64/onyx.tar.gz
asset_name: onyx-linux-ovm-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux AMD64 with Wasmer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-wasmer-amd64/onyx.tar.gz
asset_name: onyx-linux-wasmer-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux AMD64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-none-amd64/onyx.tar.gz
asset_name: onyx-linux-none-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux ARM64 with OVM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-ovm-arm64/onyx.tar.gz
asset_name: onyx-linux-ovm-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux ARM64 with Wasmer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-wasmer-arm64/onyx.tar.gz
asset_name: onyx-linux-wasmer-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-none-arm64/onyx.tar.gz
asset_name: onyx-linux-none-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS AMD64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-none-amd64/onyx.tar.gz
asset_name: onyx-darwin-none-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-none-arm64/onyx.tar.gz
asset_name: onyx-darwin-none-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS AMD64 (Wasmser)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-wasmer-amd64/onyx.tar.gz
asset_name: onyx-darwin-wasmer-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS ARM64 (Wasmer)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-wasmer-arm64/onyx.tar.gz
asset_name: onyx-darwin-wasmer-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS AMD64 (OVMwasm)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-ovm-amd64/onyx.tar.gz
asset_name: onyx-darwin-ovm-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS ARM64 (OVMwasm)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-ovm-arm64/onyx.tar.gz
asset_name: onyx-darwin-ovm-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Window X64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-windows-wasmer-amd64/onyx.zip
asset_name: onyx-windows-wasmer-amd64.zip
asset_content_type: application/zip