athena/.github/workflows/build.yml

266 lines
7.8 KiB
YAML
Raw Normal View History

2021-04-13 00:03:17 +00:00
name: Build
2021-04-08 20:18:20 +00:00
on:
push:
2021-04-13 00:03:17 +00:00
pull_request:
2021-06-12 01:05:23 +00:00
env:
2023-05-29 12:56:36 +00:00
BUILDCACHE_VERSION: v0.28.3
2021-06-12 01:05:23 +00:00
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
2021-04-08 20:18:20 +00:00
jobs:
2021-04-13 00:03:17 +00:00
build-linux-x86_64:
2021-04-08 20:18:20 +00:00
name: Build Linux (GCC x86_64)
runs-on: ubuntu-20.04
2021-06-12 01:05:23 +00:00
env:
2023-05-29 12:56:36 +00:00
LLVM_MAJOR: 15
2021-06-12 01:05:23 +00:00
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
2021-04-08 20:18:20 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get -y update
2023-05-29 12:56:36 +00:00
sudo apt-get -y install cmake ninja-build llvm-$LLVM_MAJOR-dev libclang-$LLVM_MAJOR-dev clang-$LLVM_MAJOR zlib1g-dev
2021-06-12 01:05:23 +00:00
# setup buildcache
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
2021-04-08 20:18:20 +00:00
2021-06-12 01:05:23 +00:00
- name: Restore buildcache
uses: actions/cache@v2
2021-04-08 20:18:20 +00:00
with:
2021-06-12 01:05:23 +00:00
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-ubuntu-20.04-x86_64
2021-04-08 20:18:20 +00:00
2021-04-12 23:39:36 +00:00
- name: Configure CMake
2021-04-08 20:18:20 +00:00
run: |
2021-06-12 01:05:23 +00:00
cmake -B build . -GNinja \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
-DATDNA_DYNAMIC_LLVM=OFF \
2023-05-29 12:56:36 +00:00
-DClang_DIR:PATH=/usr/lib/cmake/clang-$LLVM_MAJOR \
2021-06-12 01:05:23 +00:00
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
2021-04-12 23:39:36 +00:00
- name: Build
run: cmake --build build --target package --verbose
2021-04-08 20:18:20 +00:00
2021-06-12 01:05:23 +00:00
- name: Print buildcache stats
run: buildcache -s
2021-04-08 20:18:20 +00:00
- name: Test
working-directory: build
run: ./atdna-test
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-13 00:03:17 +00:00
name: atdna-linux-x86_64
2021-04-08 20:18:20 +00:00
path: |
2021-04-12 23:39:36 +00:00
build/athena-*.tar.gz
2021-04-08 20:18:20 +00:00
2021-04-13 00:03:51 +00:00
build-linux-aarch64:
2021-04-08 20:18:20 +00:00
name: Build Linux (GCC aarch64)
runs-on: ubuntu-20.04
2021-06-12 01:05:23 +00:00
2023-05-29 12:56:36 +00:00
env:
LLVM_MAJOR: 15
2021-04-08 20:18:20 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- uses: uraimo/run-on-arch-action@v2.0.9
2021-04-12 23:39:36 +00:00
name: Build & test
2021-04-08 20:18:20 +00:00
with:
arch: aarch64
distro: ubuntu20.04
githubToken: ${{github.token}}
dockerRunArgs: |
--volume "${PWD}:/workspace"
install: |
apt-get -y update
2023-05-29 12:56:36 +00:00
apt-get -y install build-essential cmake ninja-build llvm-$LLVM_MAJOR-dev libclang-$LLVM_MAJOR-dev clang-$LLVM_MAJOR zlib1g-dev
2021-04-08 20:18:20 +00:00
run: |
2021-06-12 01:05:23 +00:00
cmake -B build . -GNinja \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
2023-05-29 12:56:36 +00:00
-DClang_DIR:PATH=/usr/lib/cmake/clang-$LLVM_MAJOR
2021-04-12 23:39:36 +00:00
cmake --build build --target package --verbose
build/atdna-test
2021-04-08 20:18:20 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-13 00:03:17 +00:00
name: atdna-linux-aarch64
2021-04-08 20:18:20 +00:00
path: |
2021-04-12 23:39:36 +00:00
build/athena-*.tar.gz
2021-04-08 20:18:20 +00:00
2021-04-13 00:03:17 +00:00
build-macos-universal:
2021-04-08 20:18:20 +00:00
name: Build macOS (AppleClang universal)
2023-05-29 13:00:41 +00:00
runs-on: macos-13
2021-06-12 01:05:23 +00:00
env:
2023-05-29 12:56:36 +00:00
LLVM_MAJOR: 15
LLVM_VERSION: 15.0.7_2
2021-06-12 01:05:23 +00:00
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
2021-04-08 20:18:20 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
2021-04-12 20:12:36 +00:00
brew update
2021-06-12 01:05:23 +00:00
brew install ninja
2021-04-08 20:18:20 +00:00
# universal clang+llvm from macports
2023-05-29 12:56:36 +00:00
curl -LSfs https://axiodl.com/files/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg -o /tmp/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg
sudo installer -pkg /tmp/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg -target /
2021-04-08 20:18:20 +00:00
2021-06-12 01:05:23 +00:00
# setup buildcache
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
- name: Restore buildcache
uses: actions/cache@v2
2021-04-08 20:18:20 +00:00
with:
2021-06-12 01:05:23 +00:00
path: ${{env.BUILDCACHE_DIR}}
2023-05-29 12:56:36 +00:00
key: buildcache-macos-12
2021-04-08 20:18:20 +00:00
2021-04-12 20:12:36 +00:00
- name: Configure CMake
2021-04-08 20:18:20 +00:00
run: |
2021-06-12 01:05:23 +00:00
cmake -B build . -GNinja \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
-DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" \
2023-05-29 13:30:31 +00:00
-DCMAKE_PREFIX_PATH:PATH=/opt/local \
2023-05-29 12:56:36 +00:00
-DLLVM_ROOT_DIR:PATH=/opt/local/libexec/llvm-$LLVM_MAJOR \
2021-06-12 01:05:23 +00:00
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
2021-04-12 20:12:36 +00:00
- name: Build
2021-04-12 23:39:36 +00:00
run: cmake --build build --target package --verbose
2021-04-08 20:18:20 +00:00
2021-06-12 01:05:23 +00:00
- name: Print buildcache stats
run: buildcache -s
2021-04-08 20:18:20 +00:00
- name: Test
working-directory: build
run: ./atdna-test
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-13 00:03:17 +00:00
name: athena-macos-universal
2021-04-08 20:18:20 +00:00
path: |
2021-04-12 23:39:36 +00:00
build/athena-*.tar.gz
2021-04-12 20:12:36 +00:00
2021-04-13 00:03:17 +00:00
build-win32-amd64:
name: Build Windows (MSVC AMD64)
2023-05-29 13:00:41 +00:00
runs-on: windows-2022
2021-06-12 01:05:23 +00:00
2021-04-12 20:12:36 +00:00
env:
2023-05-29 12:56:36 +00:00
LLVM_VERSION: 15.0.7
2021-06-12 01:05:23 +00:00
BUILDCACHE_DIR: C:\buildcache
2021-04-12 20:12:36 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install LLVM
run: |
2021-06-12 01:05:23 +00:00
$TempDir = "C:\temp" # C: has more space
$Filename = "vcpkg-llvm-$env:LLVM_VERSION-full.7z"
2021-04-12 20:12:36 +00:00
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
2021-06-12 01:05:23 +00:00
7z x "-o$TempDir" -aos "$TempDir\$Filename"
2021-04-12 20:12:36 +00:00
- name: Install dependencies
2021-06-12 01:05:23 +00:00
run: |
choco install ninja
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://github.com/mbitsnbites/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip")
Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir"
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Restore buildcache
uses: actions/cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-windows-2019-msvc-amd64
2021-04-12 20:12:36 +00:00
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
run: |
2021-06-12 01:05:23 +00:00
cmake -B build . -GNinja `
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo `
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded `
-DCMAKE_TOOLCHAIN_FILE:PATH="C:\temp\vcpkg-llvm-$env:LLVM_VERSION\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static
2021-04-12 20:12:36 +00:00
- name: Build
2021-04-12 23:39:36 +00:00
run: cmake --build build --target package --verbose
2021-04-12 20:12:36 +00:00
2021-06-12 01:05:23 +00:00
- name: Print buildcache stats
run: buildcache -s
2021-04-12 20:12:36 +00:00
- name: Test
working-directory: build
run: ./atdna-test.exe
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-13 00:03:17 +00:00
name: athena-win32-amd64
2021-04-12 20:12:36 +00:00
path: |
2021-04-13 00:03:17 +00:00
build/athena-*.7z
release:
name: Release
runs-on: ubuntu-20.04
2021-06-12 01:05:23 +00:00
2021-04-13 00:03:17 +00:00
if:
contains('
refs/heads/master
refs/heads/test
', github.ref)
needs:
- build-linux-x86_64
- build-linux-aarch64
- build-macos-universal
- build-win32-amd64
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Create release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{github.token}}
automatic_release_tag: latest
prerelease: true
title: Development build
files: |
2021-04-13 00:17:35 +00:00
artifacts/*/*