diff --git a/.github/actions/composite/setup-certificate-1p/action.yml b/.github/actions/composite/setup-certificate-1p/action.yml new file mode 100644 index 000000000..0f7d05e3c --- /dev/null +++ b/.github/actions/composite/setup-certificate-1p/action.yml @@ -0,0 +1,16 @@ +name: Set up mirror certificates +description: Set up mirror certificates + +runs: + using: composite + steps: + - name: Install 1Password CLI + uses: 1password/install-cli-action@v1 + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ env.OP_SERVICE_ACCOUNT_TOKEN }} + + - name: Update SSL Certificates from 1Password + run: | + op document get --output expensify.ca.crt expensify.ca.crt && sudo cp expensify.ca.crt /usr/local/share/ca-certificates/expensify.ca.crt + sudo update-ca-certificates + shell: bash diff --git a/.github/workflows/bedrock.yml b/.github/workflows/bedrock.yml new file mode 100644 index 000000000..1375a444b --- /dev/null +++ b/.github/workflows/bedrock.yml @@ -0,0 +1,90 @@ +name: Bedrock Test Suite +on: + push: + branches: # this ignores tag pushes, and only looks at branches. + - '**' + release: + types: [prereleased] +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true +env: + CCACHE_BASEDIR: "/home/runner/.cache/ccache" + # Use mirror.bastion1.sjc if running locally + APT_MIRROR_URL: "apt-mirror.expensify.com:843" +jobs: + Run_Bedrock_Tests: + name: "Create Bedrock and Test" + runs-on: ubuntu-20.04-v64 # The biggest and best for my baby + timeout-minutes: 30 + steps: + + - name: Checkout Bedrock + uses: actions/checkout@v4.1.0 + + - name: Get Date for cache + id: get-date + run: | + echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT + shell: bash + + - name: Set up cache + uses: actions/cache@v4.0.0 + with: + path: |- + ${{ env.CCACHE_BASEDIR }} + key: "${{ runner.os }}-compilation-${{ github.ref_name }}-${{ github.sha }}" + restore-keys: | + ${{ runner.os }}-compilation-${{ github.ref_name }}- + ${{ runner.os }}-compilation- + + - name: Setup Mirror Certificates + uses: ./.github/actions/composite/setup-certificate-1p + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + + - name: Install packages + run: | + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA9EF27F + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C + wget -qO - https://package.perforce.com/perforce.pubkey --no-check-certificate | sudo apt-key add - + echo "deb [arch=amd64] https://travis:${{ secrets.TRAVIS_APT_PASSWORD }}@$APT_MIRROR_URL/mirror/ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal main" | sudo tee -a /etc/apt/sources.list + sudo apt-get update -y + sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install rsyslog cmake gcc-13 g++-13 libsodium-dev libgpgme11-dev libstdc++-13-dev + sudo locale-gen "en_US.UTF-8" + sudo service rsyslog start + + - name: Use updated ccache + run: | + wget https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-linux-x86_64.tar.xz + tar -xf ccache-4.8.3-linux-x86_64.tar.xz + sudo cp ccache-4.8.3-linux-x86_64/ccache /usr/local/bin/ccache + ccache -V + ln -s /usr/local/bin/ccache /usr/local/bin/gcc-13 + ln -s /usr/local/bin/ccache /usr/local/bin/g++-13 + + - name: Setup tmate session + if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 60 + with: + limit-access-to-actor: true + + # If tmate was run, we want to mark this step as failed so bedrock tests don't look like they're passing + - name: Mark failure if debugging + if: runner.debug == '1' + run: exit 1 + + - name: Run tests + run: "./ci_tests.sh" + + - name: Upload bedrock binary to release + if: "${{ startsWith(github.ref, 'refs/tags/') }}" + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_REPOSITORY: "${{ github.repository }}" + with: + files: |- + ./bedrock + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 478e3edb6..000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -env: - global: - - CXX=g++-13 CC=gcc-13 - - secure: gIOAWHsP6BaQgQc/IBEqdcyzMepMQFoKL4BzFwysbTcX3yIT3k5iSHpoCH/+RuHOB8XZl+xOwbOyuV+ujgbb70WB1ycYiQRhYZiX1kdmjodbbqgh9ZbGYajN62sI0JrTin4mGFnTwNJ0g1nuneuqIh0z5bszu+fcbfrqmaYkxO3cKUhyPp1jl7iAFmqkhnnLmXsi0N7d3yn1rLYfEfya9e4LOAC4pKPJUJzrs7vcavRVuFOAL3Lg+DyDsbBHy330SZEERUyX5Jb44nVJ3j9XGrujnPhlwan8wye9vrCrtRhC1lo2cllV9m0oSboJsV9A+bMQ2kgFqjZTMyZyjsQrflYNYhLpiFp3qVCTHpGH7jS6pUOXzRn/T+BUns4/4RJE5EsDzgBOg90oBVNGU++zJjCGMRaOp2LJt7uSCSc8kHEzfgvbcaGI9CPSlZLILVcrifUCNzktbEtQXEJ7SAtsSDI8sbxtBKvL0wExxx8FpKSY4yvRU7xfMhumzU4Ngufz3521MyZkYsOJVE02N/D+jzHRTjGRypatm9QfHeQmRuawT+aZ/Vra9jVTBelFkibshXAiVAm8kkAq4xz9Pml31+nsNUIo9rwfzyPdLAx8qV31EFmf55zggHu0LuEO1mp46y82oPakO6BxVdRtAUnZogagMWflant/KqRlzRsQt/M= -notifications: - email: - on_success: never -script: ./travis.sh -os: linux -dist: focal -group: edge -language: cpp -vm: - size: 2x-large -before_script: - - nproc - - free -m -cache: - - ccache: true -deploy: - provider: releases - edge: - branch: v2.0.3-beta.4 - # `token` is an encrypted oauth token for johnmlee101. See https://docs.travis-ci.com/user/deployment/releases - token: - secure: gIOAWHsP6BaQgQc/IBEqdcyzMepMQFoKL4BzFwysbTcX3yIT3k5iSHpoCH/+RuHOB8XZl+xOwbOyuV+ujgbb70WB1ycYiQRhYZiX1kdmjodbbqgh9ZbGYajN62sI0JrTin4mGFnTwNJ0g1nuneuqIh0z5bszu+fcbfrqmaYkxO3cKUhyPp1jl7iAFmqkhnnLmXsi0N7d3yn1rLYfEfya9e4LOAC4pKPJUJzrs7vcavRVuFOAL3Lg+DyDsbBHy330SZEERUyX5Jb44nVJ3j9XGrujnPhlwan8wye9vrCrtRhC1lo2cllV9m0oSboJsV9A+bMQ2kgFqjZTMyZyjsQrflYNYhLpiFp3qVCTHpGH7jS6pUOXzRn/T+BUns4/4RJE5EsDzgBOg90oBVNGU++zJjCGMRaOp2LJt7uSCSc8kHEzfgvbcaGI9CPSlZLILVcrifUCNzktbEtQXEJ7SAtsSDI8sbxtBKvL0wExxx8FpKSY4yvRU7xfMhumzU4Ngufz3521MyZkYsOJVE02N/D+jzHRTjGRypatm9QfHeQmRuawT+aZ/Vra9jVTBelFkibshXAiVAm8kkAq4xz9Pml31+nsNUIo9rwfzyPdLAx8qV31EFmf55zggHu0LuEO1mp46y82oPakO6BxVdRtAUnZogagMWflant/KqRlzRsQt/M= - file: - - bedrock - skip_cleanup: true - prerelease: true - on: - tags: true diff --git a/ci_tests.sh b/ci_tests.sh new file mode 100755 index 000000000..e0e8cd8f5 --- /dev/null +++ b/ci_tests.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +export CXX=g++-13 +export CC=gcc-13 + +# Add the current working directory to $PATH so that tests can find bedrock. +export PATH=$PATH:`pwd` + +export CCACHE_COMPILERCHECK="mtime" + +# We have include_file_ctime and include_file_mtime since travis never modifies the header file during execution +# and gh actions shouldn't care about ctime and mtime between new branches. +export CCACHE_SLOPPINESS="pch_defines,time_macros,include_file_ctime,include_file_mtime" +export CCACHE_MAXSIZE="1G" + +# ccache recommends a compression level of 5 or less for faster compilations. +# Compression speeds up the tar and untar of the cache between travis runs. +export CCACHE_COMPRESS="true" +export CCACHE_COMPRESSLEVEL="1" + +mark_fold() { + local action=$1 + local name=$2 + + # if action == end, just print out ::endgroup:: + if [[ "$action" == "end" ]]; then + echo ::endgroup:: + return + fi + + echo "::group::${name}" +} + +# don't print out versions until after they are installed +${CC} --version +${CXX} --version + +mark_fold start build_bedrock +make -j64 +mark_fold end build_bedrock + +mark_fold start test_bedrock +cd test +./test -threads 64 +cd .. +mark_fold end test_bedrock + +mark_fold start test_bedrock_cluster +cd test/clustertest +./clustertest -threads 8 +cd ../.. +mark_fold end test_bedrock_cluster + +strip bedrock diff --git a/travis.sh b/travis.sh deleted file mode 100755 index 1ea55a8c8..000000000 --- a/travis.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -set -e - -export CXX=g++-13 -export CC=gcc-13 - -# Add the current working directory to $PATH so that tests can find bedrock. -export PATH=$PATH:`pwd` - -# Configure ccache settings for travis. -export PATH=/usr/lib/ccache:$PATH -/usr/sbin/update-ccache-symlinks - -export CCACHE_COMPILERCHECK="mtime" - -# We have include_file_ctime and include_file_mtime since travis never modifies the header file during execution -# and travis shouldn't care about ctime and mtime between new branches. -export CCACHE_SLOPPINESS="pch_defines,time_macros,include_file_ctime,include_file_mtime" -export CCACHE_MAXSIZE="5G" - -# ccache recommends a compression level of 5 or less for faster compilations. -# Compression speeds up the tar and untar of the cache between travis runs. -export CCACHE_COMPRESS="true" -export CCACHE_COMPRESSLEVEL="1" - -travis_time_start() { - travis_timer_id=$(printf %08x $(( RANDOM * RANDOM ))) - travis_start_time=$(travis_nanoseconds) - echo -en "travis_time:start:$travis_timer_id\r${ANSI_CLEAR}" -} - -travis_time_finish() { - local result=$? - travis_end_time=$(travis_nanoseconds) - local duration=$(($travis_end_time-$travis_start_time)) - echo -en "travis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r${ANSI_CLEAR}" - return $result -} - -travis_nanoseconds() { - local cmd="date" - local format="+%s%N" - local os=$(uname) - - if hash gdate > /dev/null 2>&1; then - cmd="gdate" # use gdate if available - elif [[ "$os" = Darwin ]]; then - format="+%s000000000" # fallback to second precision on darwin (does not support %N) - fi - - $cmd -u $format -} - -travis_fold() { - local action=$1 - local name=$2 - echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" -} - -travis_fold start install_packages -travis_time_start - -if [[ -z "${APT_MIRROR_PASSWORD}" ]]; then - echo "Running on a fork, using public apt mirror" - sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" -else - echo "Not running a fork, using private apt mirror" - sudo openssl aes-256-cbc -K $encrypted_f9e02b3c1033_key -iv $encrypted_f9e02b3c1033_iv -in expensify.ca.crt.enc -out /usr/local/share/ca-certificates/expensify.ca.crt -d - sudo update-ca-certificates - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA9EF27F - echo "deb [arch=amd64] https://travis:$APT_MIRROR_PASSWORD@apt-mirror.expensify.com:843/mirror/ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal main" | sudo tee -a /etc/apt/sources.list -fi - -sudo apt-get update -y -sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install gcc-13 g++-13 - -travis_time_finish -travis_fold end build_bedrock - -# don't print out versions until after they are installed -${CC} --version -${CXX} --version - -travis_fold start build_bedrock -travis_time_start -make -j32 -travis_time_finish -travis_fold end build_bedrock - -travis_fold start test_bedrock -travis_time_start -cd test -./test -threads 32 -cd .. -travis_time_finish -travis_fold end test_bedrock - -travis_fold start test_bedrock_cluster -travis_time_start -cd test/clustertest -./clustertest -threads 8 -cd ../.. -travis_time_finish -travis_fold end test_bedrock_cluster