-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update GitHub Actions: Build with Clang-14, macOS Run unit tests tests on Ubuntu-20.04 Remove packaging from GitHub Don't ignore every build folder * Abide clang-format * GitHub hosted runners for now.
- Loading branch information
Showing
14 changed files
with
413 additions
and
147 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: build | ||
description: "Build xbridge_witnessd" | ||
inputs: | ||
generator: | ||
description: "CMake generator" | ||
default: null | ||
configuration: | ||
description: "CMake CMAKE_BUILD_TYPE" | ||
required: true | ||
cmake-args: | ||
description: "Additional args to pass to CMake" | ||
default: null | ||
cmake-target: | ||
description: "CMake's build --target argument" | ||
default: all | ||
# An implicit input is the environment variable `build_dir`. | ||
runs: | ||
using: composite | ||
steps: | ||
- name: configure | ||
shell: bash | ||
run: | | ||
cd ${build_dir} | ||
cmake \ | ||
${{ inputs.generator && format('-G "{0}"', inputs.generator) || '' }} \ | ||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${build_dir}/conan_toolchain.cmake \ | ||
-DCMAKE_BUILD_TYPE=${{ inputs.configuration }} \ | ||
${{ inputs.cmake-args }} \ | ||
.. | ||
- name: build | ||
shell: bash | ||
run: | | ||
cmake \ | ||
--build ${build_dir} \ | ||
--config ${{ inputs.configuration }} \ | ||
--parallel ${NUM_PROCESSORS:-$(nproc)} \ | ||
--target ${{ inputs.cmake-target }} \ | ||
-- --verbose |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: dependencies | ||
inputs: | ||
configuration: | ||
required: true | ||
# An implicit input is the environment variable `build_dir`. | ||
runs: | ||
using: composite | ||
steps: | ||
- name: unlock Conan | ||
shell: bash | ||
run: conan remove --locks | ||
|
||
- name: export custom recipes | ||
shell: bash | ||
run: | | ||
conan config set general.revisions_enabled=1 | ||
- name: add Ripple Conan remote | ||
shell: bash | ||
run: | | ||
conan remote list | ||
conan remote remove ripple || true | ||
# Do not quote the URL. An empty string will be accepted (with | ||
# a non-fatal warning), but a missing argument will not. | ||
conan remote add ripple ${{ env.CONAN_URL }} --insert 0 | ||
- name: try to authenticate to Ripple Conan remote | ||
id: remote | ||
shell: bash | ||
run: | | ||
# `conan user` implicitly uses the environment variables | ||
# CONAN_LOGIN_USERNAME_<REMOTE> and CONAN_PASSWORD_<REMOTE>. | ||
# https://docs.conan.io/1/reference/commands/misc/user.html#using-environment-variables | ||
# https://docs.conan.io/1/reference/env_vars.html#conan-login-username-conan-login-username-remote-name | ||
# https://docs.conan.io/1/reference/env_vars.html#conan-password-conan-password-remote-name | ||
echo outcome=$(conan user --remote ripple --password >&2 \ | ||
&& echo success || echo failure) | tee ${GITHUB_OUTPUT} | ||
- name: list missing binaries | ||
id: binaries | ||
shell: bash | ||
# Print the list of dependencies that would need to be built locally. | ||
# A non-empty list means we have "failed" to cache binaries remotely. | ||
run: | | ||
echo missing=$(conan info . --build missing --settings build_type=${{ inputs.configuration }} --json 2>/dev/null | grep '^\[') | tee ${GITHUB_OUTPUT} | ||
- name: install dependencies | ||
shell: bash | ||
run: | | ||
mkdir ${build_dir} | ||
cd ${build_dir} | ||
conan install \ | ||
--output-folder . \ | ||
--build missing \ | ||
--settings build_type=${{ inputs.configuration }} \ | ||
.. | ||
- name: upload dependencies to remote | ||
if: (steps.binaries.outputs.missing != '[]') && (steps.remote.outputs.outcome == 'success') | ||
shell: bash | ||
run: conan upload --remote ripple '*' --all --parallel --confirm |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: clang-format | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
CLANG_VERSION: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install clang-format | ||
run: | | ||
codename=$( lsb_release --codename --short ) | ||
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF | ||
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main | ||
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main | ||
EOF | ||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add | ||
sudo apt-get update | ||
sudo apt-get install clang-format-${CLANG_VERSION} | ||
- name: Format src/xbwd | ||
run: find src/xbwd -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 clang-format-${CLANG_VERSION} -i | ||
- name: Format src/test | ||
run: find src/test -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 clang-format-${CLANG_VERSION} -i | ||
- name: Check for differences | ||
id: assert | ||
run: | | ||
set -o pipefail | ||
git diff --exit-code | tee "clang-format.patch" | ||
- name: Upload patch | ||
if: failure() && steps.assert.outcome == 'failure' | ||
uses: actions/upload-artifact@v4 | ||
continue-on-error: true | ||
with: | ||
name: clang-format.patch | ||
if-no-files-found: ignore | ||
path: clang-format.patch | ||
- name: What happened? | ||
if: failure() && steps.assert.outcome == 'failure' | ||
env: | ||
PREAMBLE: | | ||
If you are reading this, you are looking at a failed Github Actions | ||
job. That means you pushed one or more files that did not conform | ||
to the formatting specified in .clang-format. That may be because | ||
you neglected to run 'git clang-format' or 'clang-format' before | ||
committing, or that your version of clang-format has an | ||
incompatibility with the one on this | ||
machine, which is: | ||
SUGGESTION: | | ||
To fix it, you can do one of two things: | ||
1. Download and apply the patch generated as an artifact of this | ||
job to your repo, commit, and push. | ||
2. Run 'git-clang-format --extensions c,cpp,h,cxx,ipp develop' | ||
in your repo, commit, and push. | ||
run: | | ||
echo "${PREAMBLE}" | ||
clang-format-${CLANG_VERSION} --version | ||
echo "${SUGGESTION}" | ||
exit 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Build macOS | ||
on: | ||
pull_request: | ||
push: | ||
# If the branches list is ever changed, be sure to change it on all | ||
# build/test jobs (nix, macos, windows) | ||
branches: | ||
# Always build the package branches | ||
- develop | ||
- release | ||
- master | ||
# Branches that opt-in to running | ||
- 'ci/**' | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
platform: | ||
- macos | ||
generator: | ||
- Ninja | ||
configuration: | ||
- Release | ||
# runs-on: [self-hosted, macOS] # runs-on: [self-hosted, macOS] # TODO: Use self-host when https://ripplelabs.atlassian.net/browse/RXIT-210 resolved | ||
runs-on: macos-latest | ||
env: | ||
# The `build` action requires these variables. | ||
build_dir: .build | ||
NUM_PROCESSORS: 12 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: install Conan | ||
run: | | ||
brew install conan@1 | ||
echo '/opt/homebrew/opt/conan@1/bin' >> $GITHUB_PATH | ||
- name: install Ninja | ||
if: matrix.generator == 'Ninja' | ||
run: brew install ninja | ||
- name: check environment | ||
run: | | ||
env | sort | ||
echo ${PATH} | tr ':' '\n' | ||
python --version | ||
conan --version | ||
cmake --version | ||
- name: configure Conan | ||
run : | | ||
conan profile new default --detect || true | ||
conan profile update settings.compiler.cppstd=20 default | ||
conan profile update 'conf.tools.build:cxxflags=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default | ||
- name: build dependencies | ||
uses: ./.github/actions/dependencies | ||
env: | ||
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod | ||
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }} | ||
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }} | ||
with: | ||
configuration: ${{ matrix.configuration }} | ||
- name: build | ||
uses: ./.github/actions/build | ||
with: | ||
generator: ${{ matrix.generator }} | ||
configuration: ${{ matrix.configuration }} | ||
- name: test | ||
run: | | ||
${build_dir}/xbridge_witnessd --unittest |
Oops, something went wrong.