Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add a CI github workflow for Ubuntu and MacOS. #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/macos-13.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: <text>Copyright 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
#
# 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
# 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.
#
# This file is part of the Arm Disassembly Library

name: "MacOS Ventura"

on: [push, pull_request]

jobs:
macos-13-ci:
uses: ./.github/workflows/main.yml
with:
os: macos-13
27 changes: 27 additions & 0 deletions .github/workflows/macos-14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: <text>Copyright 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
#
# 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
# 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.
#
# This file is part of the Arm Disassembly Library

name: "MacOS Sonoma"

on: [push, pull_request]

jobs:
macos-14-ci:
uses: ./.github/workflows/main.yml
with:
os: macos-14
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-FileCopyrightText: <text>Copyright 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
#
# 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
# 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.
#
# This file is part of the Arm Disassembly Library

name: CI

on:
workflow_call:
inputs:
os:
required: true
type: string

jobs:
build_install_test:
name: "Build, test, install and run example on ${{ matrix.os }}."
runs-on: ${{ inputs.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install build Toml
- name: Build
run: |
source venv/bin/activate
./build.sh
- name: Install
run: |
source venv/bin/activate
VERSION=$(python -c "import toml; print(toml.load('python/pyproject.toml')['project']['version'])")
python3 -m pip install python/dist/armdisasm-${VERSION}-py3-none-any.whl
- name: Test example
run: |
source venv/bin/activate
python3 examples/api_demo.py -i 0xb8607b21
27 changes: 27 additions & 0 deletions .github/workflows/ubuntu-2004.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: <text>Copyright 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
#
# 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
# 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.
#
# This file is part of the Arm Disassembly Library

name: "Ubuntu 20.04"

on: [push, pull_request]

jobs:
ubuntu-2004-ci:
uses: ./.github/workflows/main.yml
with:
os: ubuntu-20.04
27 changes: 27 additions & 0 deletions .github/workflows/ubuntu-2204.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: <text>Copyright 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
#
# 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
# 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.
#
# This file is part of the Arm Disassembly Library

name: "Ubuntu 22.04"

on: [push, pull_request]

jobs:
ubuntu-2204-ci:
uses: ./.github/workflows/main.yml
with:
os: ubuntu-22.04
27 changes: 27 additions & 0 deletions .github/workflows/ubuntu-2404.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: <text>Copyright 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
#
# 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
# 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.
#
# This file is part of the Arm Disassembly Library

name: "Ubuntu 24.04"

on: [push, pull_request]

jobs:
ubuntu-2004-ci:
uses: ./.github/workflows/main.yml
with:
os: ubuntu-24.04
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[![Ubuntu-2004 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2004.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2004.yml "Ubuntu 20.04 build status")
[![Ubuntu-2204 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2204.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2204.yml "Ubuntu 22.04 build status")
[![Ubuntu-2404 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2404.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/ubuntu-2404.yml "Ubuntu 24.04 build status")
[![MacOS13 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-13.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-13.yml "MacOS Ventura build status")
[![MacOS14 build](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-14.yml/badge.svg)](https://github.com/ArmDeveloperEcosystem/disassembly-library/actions/workflows/macos-14.yml "MacOS Sonoma build status")

# Arm Disassembly Library

Arm Disassembly Library is a software library and API for decoding and disassembling AArch64 instructions.
Expand Down Expand Up @@ -78,7 +84,7 @@ For more information and examples on how to use this tool, check out the [Arm Le

## Compatibility

This library can be built for any platform, however it has only been tested on AArch64 Linux and x86-64 Linux. Currently, only AArch64 instructions are supported.
This library can be built for any platform, however it has only been tested on AArch64 Linux and x86-64 Linux and MacOS. Currently, only AArch64 instructions are supported.

Please consider raising a [GitHub issue](https://github.com/ArmDeveloperEcosystem/disassembly-library/issues/new) if this tool does not work as expected on your system.

Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ set -e
LLVM_GIT_TAG=llvmorg-18.1.8
LLVM_TEMP_DIR=llvm-temp
LLVM_LIB_DIR=llvmlib
MAX_BUILD_JOBS=$(nproc --all)
PLATFORM=$(uname -s)

case $PLATFORM in
Darwin)
LIB_EXT=".dylib"
MAX_BUILD_JOBS=$(sysctl -n hw.logicalcpu)
;;
*)
LIB_EXT=".so"
MAX_BUILD_JOBS=$(nproc --all)
;;
esac

Expand Down