Feature/skaled 1431 ftq hotfix #706
Workflow file for this run
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
name: Build and publish skaled container | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- 'v*.*.*' | |
- master | |
- develop | |
- beta | |
- stable | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
if: github.event.pull_request.merged == true | |
runs-on: self-hosted | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
steps: | |
- name: update apt | |
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update | |
- name: install packages | |
run: | | |
sudo apt-get -y remove libzmq* || true | |
sudo apt-get -y install software-properties-common | |
sudo apt-get -y install gcc-9 g++-9 | |
- name: Use g++-9 and gcov-9 by default | |
run: | | |
echo "Updating all needed alternatives" | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 | |
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-9 9 | |
sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-9 9 | |
sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-9 9 | |
echo "Checking alternative for gcc" | |
which gcc | |
gcc --version | |
echo "Checking alternative for g++" | |
which g++ | |
g++ --version | |
echo "Checking alternative for gcov" | |
which gcov | |
gcov --version | |
echo "Checking alternative for gcov-dump" | |
which gcov-dump | |
gcov-dump --version | |
echo "Checking alternative for gcov-tool" | |
which gcov-tool | |
gcov-tool --version | |
- name: Extract repo name | |
run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') | |
shell: bash | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: Submodule update | |
run: | | |
rm -f /home/vagrant/actions-runner*/_work/skaled/skaled/.git/modules/libconsensus/index.lock | |
rm -rf ./libconsensus || true | |
ls -1 | |
git submodule update --init --recursive | |
- name: Cleanup containers | |
run: docker system prune -a -f | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
shell: cmake -P {0} | |
run: | | |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) | |
message("::set-output name=timestamp::${current_date}") | |
- name: Ccache cache files | |
uses: actions/[email protected] | |
with: | |
path: .ccache | |
key: ${ { matrix.config.name } }-ccache-${ { steps.ccache_cache_timestamp.outputs.timestamp } } | |
restore-keys: | | |
${ { matrix.config.name } }-ccache- | |
- name: Build dependencies | |
run: | | |
export CC=gcc-9 | |
export CXX=g++-9 | |
export TARGET=all | |
export CMAKE_BUILD_TYPE=RelWithDebInfo | |
cd deps | |
./clean.sh | |
rm -f ./libwebsockets-from-git.tar.gz | |
./build.sh PARALLEL_COUNT=$(nproc) | |
cd .. | |
- name: Configure all | |
run: | | |
export CC=gcc-9 | |
export CXX=g++-9 | |
export TARGET=all | |
export CMAKE_BUILD_TYPE=RelWithDebInfo | |
mkdir -p build | |
cd build | |
# -DCMAKE_C_FLAGS=-O3 -DCMAKE_CXX_FLAGS=-O3 | |
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE .. | |
cd .. | |
- name: Build all | |
run: | | |
export CC=gcc-9 | |
export CXX=g++-9 | |
export TARGET=all | |
export CMAKE_BUILD_TYPE=RelWithDebInfo | |
cd build | |
make skaled -j$(nproc) | |
#echo "Ensure release mode skaled does not have any debug markers" | |
cp skaled/skaled skaled/skaled-debug | |
strip skaled/skaled | |
cd .. | |
- name: Configure historic state build | |
run: | | |
export CC=gcc-9 | |
export CXX=g++-9 | |
export TARGET=all | |
export CMAKE_BUILD_TYPE=RelWithDebInfo | |
mkdir -p build-historic | |
cd build-historic | |
# -DCMAKE_C_FLAGS=-O3 -DCMAKE_CXX_FLAGS=-O3 | |
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DHISTORIC_STATE=1 .. | |
cd .. | |
- name: Build historic state version | |
run: | | |
export CC=gcc-9 | |
export CXX=g++-9 | |
export TARGET=all | |
export CMAKE_BUILD_TYPE=RelWithDebInfo | |
cd build-historic | |
make skaled -j$(nproc) | |
#echo "Ensure release mode skaled does not have any debug markers" | |
cp skaled/skaled skaled/skaled-debug | |
strip skaled/skaled | |
cd .. | |
- name: Build and publish container | |
run: | | |
cp build/skaled/skaled scripts/skale_build/executable/ | |
export BRANCH=${GITHUB_REF##*/} | |
echo "Branch $BRANCH" | |
export VERSION=$(cat VERSION) | |
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION) | |
echo "::set-env name=VERSION::$VERSION" | |
echo "::set-env name=VERSION_ORIG::$VERSION" | |
echo "Version $VERSION" | |
( test $BRANCH = "stable" && export PRERELEASE=false ) || export PRERELEASE=true | |
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV | |
export RELEASE=true | |
echo "::set-env name=RELEASE::$RELEASE" | |
bash ./scripts/build_and_publish.sh | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: ${{ env.VERSION }} | |
draft: false | |
prerelease: ${{ env.PRERELEASE }} | |
- name: Upload skaled binary to Release | |
uses: actions/upload-release-asset@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/skaled/skaled | |
asset_name: skaled | |
asset_content_type: application/octet-stream | |
- name: Upload debug binary to Release | |
uses: actions/upload-release-asset@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/skaled/skaled-debug | |
asset_name: skaled-debug | |
asset_content_type: application/octet-stream | |
- name: Build and publish historic-state container | |
run: | | |
cp build-historic/skaled/skaled scripts/skale_build/executable/ | |
export BRANCH=${GITHUB_REF##*/} | |
echo "Branch $BRANCH" | |
export VERSION=$VERSION-historic | |
echo "::set-env name=VERSION::$VERSION" | |
echo "::set-env name=VERSION_HISTORIC::$VERSION" | |
echo "Version $VERSION" | |
export RELEASE=true | |
echo "::set-env name=RELEASE::$RELEASE" | |
bash ./scripts/build_and_publish.sh | |
- name: Upload historic-state skaled binary to Release | |
uses: actions/upload-release-asset@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build-historic/skaled/skaled | |
asset_name: skaled-historic | |
asset_content_type: application/octet-stream | |
- name: Upload historic-state debug binary to Release | |
uses: actions/upload-release-asset@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build-historic/skaled/skaled-debug | |
asset_name: skaled-debug-historic | |
asset_content_type: application/octet-stream | |
outputs: | |
version_orig: ${{ env.VERSION_ORIG }} | |
version_historic: ${{ env.VERSION_HISTORIC }} | |
functional-tests: | |
uses: ./.github/workflows/functional-tests.yml | |
name: Functional testing for orig build | |
needs: [build] | |
with: | |
version: ${{ needs.build.outputs.version_orig }} | |
secrets: inherit | |
functional-tests-historic: | |
uses: ./.github/workflows/functional-tests.yml | |
name: Functional testing for historic build | |
needs: [build] | |
with: | |
version: ${{ needs.build.outputs.version_historic }} | |
secrets: inherit |