Update README.md badges #193
Workflow file for this run
This file contains hidden or 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
# GNU General Public License, version 2.0. | |
# | |
# Copyright (c) 2025 Tijme Gommers (@tijme). | |
# | |
# This source code file is part of Dittobytes. Dittobytes is | |
# licensed under GNU General Public License, version 2.0, and | |
# you are free to use, modify, and distribute this file under | |
# its terms. However, any modified versions of this file must | |
# include this same license and copyright notice. | |
# Name of our GitHub workflow | |
name: Validation | |
# When to perform the jobs | |
on: | |
push: | |
branches: ["**"] # Trigger on any push to any branch. | |
pull_request: | |
branches: ["**"] # Trigger on any pull request to any branch. | |
# The different jobs (stages) to execute | |
jobs: | |
# The first job builds the environment and all Dittobytes tests | |
build-environment-and-tests: | |
runs-on: ubuntu-latest | |
steps: | |
# Clone the Dittobytes repository into the runner. | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Clone custom LLVM source | |
- name: Clone custom LLVM source | |
run: | | |
git clone --depth 1 --branch release/18.x https://github.com/tijme/forked-dittobytes-llvm-project.git /opt/llvm-source | |
# Get hash of custom LLVM source | |
- name: Get hash of custom LLVM source | |
id: llvm_hash | |
run: | | |
cd /opt/llvm-source | |
echo "llvm_hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
# Cache the LLVM build artifacts to speed up future builds. | |
- name: Cache LLVM build | |
uses: actions/cache@v4 | |
id: cache-llvm-build | |
with: | |
path: /opt/llvm | |
key: cache-llvm-build-${{ runner.os }}-llvmorg-18.1.8-${{ steps.llvm_hash.outputs.llvm_hash }} | |
restore-keys: | | |
cache-llvm-build-${{ runner.os }}- | |
# Cache the LLVM MinGW project to speed up future builds. | |
- name: Cache LLVM-MinGW Project | |
uses: actions/cache@v4 | |
id: cache-llvm-mingw-project | |
with: | |
path: /opt/llvm-winlin | |
key: cache-llvm-mingw-project-${{ runner.os }} | |
restore-keys: | | |
cache-llvm-mingw-project-${{ runner.os }} | |
# Cache the MacOS SDK project to speed up future builds. | |
- name: Cache MacOS SDK Project | |
uses: actions/cache@v4 | |
id: cache-macos-sdk-project | |
with: | |
path: /opt/macos-sdk | |
key: cache-macos-sdk-project-${{ runner.os }} | |
restore-keys: | | |
cache-macos-sdk-project-${{ runner.os }} | |
enableCrossOsArchive: true | |
# Install all required dependencies to build all Dittobytes tests | |
- name: Install system dependencies | |
run: | | |
sudo apt update -qqy | |
sudo apt install -qqy --no-install-recommends \ | |
gnupg2 wget ca-certificates apt-transport-https \ | |
autoconf automake cmake dpkg-dev file make patch \ | |
libc6-dev mingw-w64 nano python3 python3-pip xxd \ | |
build-essential subversion python3-dev \ | |
libncurses5-dev libxml2-dev libedit-dev \ | |
swig doxygen graphviz xz-utils gdb git \ | |
ninja-build curl zlib1g-dev libffi-dev \ | |
gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross \ | |
gcc-x86-64-linux-gnu binutils-x86-64-linux-gnu libc6-dev-amd64-cross | |
# Install Python dependencies required by Dittobytes scripts | |
- name: Install Python dependencies | |
run: | | |
python3 -m pip install -r ditto/scripts/requirements.txt --break-system-packages | |
# If not cached, install the MacOS SDK project. | |
- name: Setup MacOS SDK project if missing | |
if: steps.cache-macos-sdk-project.outputs.cache-hit != 'true' | |
run: | | |
git clone --depth 1 https://github.com/tijme/forked-dittobytes-macos-sdk.git /opt/macos-sdk | |
# If not cached, install the LLVM-MinGW project. | |
- name: Setup LLVM-MinGW if missing | |
if: steps.cache-llvm-mingw-project.outputs.cache-hit != 'true' | |
run: | | |
cd /opt | |
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-ubuntu-20.04-$(arch).tar.xz | |
tar -xf llvm-mingw-20240619-ucrt-ubuntu-20.04-$(arch).tar.xz | |
mv llvm-mingw-20240619-ucrt-ubuntu-20.04-$(arch) llvm-winlin | |
rm llvm-mingw-20240619-ucrt-ubuntu-20.04-$(arch).tar.xz | |
# If not cached, install and compile LLVM from source | |
- name: Build and install LLVM if missing | |
if: steps.cache-llvm-build.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p /opt/llvm-source/build | |
cd /opt/llvm-source/build | |
cmake -G Ninja ../llvm \ | |
-DLLVM_ENABLE_PROJECTS="clang;lld" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \ | |
-DCMAKE_INSTALL_PREFIX=/opt/llvm \ | |
-DBUILD_SHARED_LIBS=On | |
ninja | |
ninja install | |
cp -r /opt/llvm-source/build/lib/Target/X86/ /opt/llvm/include/llvm/Target/ | |
cp -r /opt/llvm-source/llvm/lib/Target/X86/ /opt/llvm/include/llvm/Target/ | |
cp -r /opt/llvm-source/build/lib/Target/AArch64/ /opt/llvm/include/llvm/Target/ | |
cp -r /opt/llvm-source/llvm/lib/Target/AArch64/ /opt/llvm/include/llvm/Target/ | |
# If LLVM install is successful, update the path environment variable. | |
- name: Set LLVM in PATH | |
run: echo "/opt/llvm/bin" >> $GITHUB_PATH | |
# Let the Dittobytes `makefile`'s know that this is a Dittobytes environment | |
- name: Indicate that this is a Dittobytes environment | |
run: touch /tmp/.dittobytes-env-all-encompassing | |
# Build all tests artifacts (transpilers) | |
- name: Build Dittobytes transpilers | |
working-directory: ${{ github.workspace }} | |
run: make ditto-transpilers | |
# Build all tests artifacts (loaders) | |
- name: Build Dittobytes loaders | |
working-directory: ${{ github.workspace }} | |
run: make ditto-loaders | |
# Build all tests artifacts | |
- name: Build Dittobytes tests | |
working-directory: ${{ github.workspace }} | |
run: make test-suite-build | |
# Upload the test artifacts for use in other jobs | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dittobytes-tests-${{ github.run_id }} | |
path: | | |
./build/beacon-* | |
./build/loader-* | |
retention-days: 1 | |
# The second job runs all available Dittobytes tests | |
run-all-tests: | |
needs: build-environment-and-tests | |
# Target OS's are an intersection of Dittobytes/GitHub supported platforms & architectures | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
windows-2022, # Windows AMD64 | |
# Windows ARM64 (not yet supported in GitHub Actions) | |
ubuntu-24.04, # Ubuntu AMD64 | |
# Ubuntu ARM64 (not yet supported in GitHub Actions) | |
# macos-15-large, # MacOS AMD64 (not supported in our subscription) | |
macos-15, # MacOS ARM64 | |
] | |
# Specify that this job needs to run on the beforementioned target OS strategy | |
runs-on: ${{ matrix.os }} | |
steps: | |
# Fix for 'missing module' errors on MacOS ARM GitHub runners | |
# https://github.com/actions/runner-images/issues/10385 | |
- name: Checkout repository | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
# Clone the Dittobytes repository into the runner. | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Download the test artifacts from the build jobs | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dittobytes-tests-${{ github.run_id }} | |
path: ./build/ | |
# Make the executables executable | |
- name: Make the executables executable | |
shell: bash | |
run: | | |
chmod +x ./build/*.exe | |
chmod +x ./build/loader-* | |
# List all the ./build/ files | |
- name: List all the build files | |
shell: bash | |
run: ls -lah ./build/ | |
# Install Python dependencies required by Dittobytes scripts | |
- name: Install Python dependencies | |
run: | | |
python3 -m pip install -r ditto/scripts/requirements.txt --break-system-packages | |
# Conditionally install dependencies on Ubuntu | |
- name: Install OS-specific dependencies (Ubuntu only) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt update -qqy | |
sudo apt install -qqy --no-install-recommends \ | |
gnupg2 wget ca-certificates apt-transport-https \ | |
autoconf automake cmake dpkg-dev file make patch \ | |
libc6-dev mingw-w64 nano python3 python3-pip xxd \ | |
build-essential subversion python3-dev \ | |
libncurses5-dev libxml2-dev libedit-dev \ | |
swig doxygen graphviz xz-utils gdb git \ | |
ninja-build curl zlib1g-dev libffi-dev \ | |
gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross \ | |
gcc-x86-64-linux-gnu binutils-x86-64-linux-gnu libc6-dev-amd64-cross \ | |
qemu-user qemu-user-static | |
# Run all available tests | |
- name: Run tests | |
run: make IS_COMPILER_CONTAINER=true test-suite-test | |