Skip to content

CI/CD - Auto build, and auto-generate release notes #1

CI/CD - Auto build, and auto-generate release notes

CI/CD - Auto build, and auto-generate release notes #1

Workflow file for this run

name: Ubuntu builds
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled]
workflow_dispatch:
workflow_call:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- builder-image: "ghcr.io/${{ github.repository_owner }}/psibase-builder-ubuntu-2004:b70111acc20bdc6990e756a855fdbf428112c059"
ubuntu-version: "2004"
- builder-image: "ghcr.io/${{ github.repository_owner }}/psibase-builder-ubuntu-2204:7e3c6e5739df95ba33943789d2cdf5472f91111a"
ubuntu-version: "2204"
steps:
- name: Timestamp
id: ccache_cache_timestamp
run: echo timestamp=`date -u +"%Y-%m-%d-%H-%M-%S"` >>$GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
- name: Preserve ccache
uses: actions/cache@v3
with:
path: .caches
key: $ubuntu-${{ matrix.ubuntu-version }}-caches-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
$ubuntu-${{ matrix.ubuntu-version }}-caches-
- name: Build
run: |
set -e
echo =====
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
git submodule update --init --recursive
echo =====
export CCACHE_DIR=${GITHUB_WORKSPACE}/.caches/ccache
export SCCACHE_DIR=${GITHUB_WORKSPACE}/.caches/sccache
export CCACHE_CONFIGPATH=${GITHUB_WORKSPACE}/ccache.conf
echo max_size = 600M >${GITHUB_WORKSPACE}/ccache.conf
echo log_file = ${GITHUB_WORKSPACE}/ccache.log >>${GITHUB_WORKSPACE}/ccache.conf
export SCCACHE_CACHE_SIZE=200M
export RUSTC_WRAPPER=sccache
export DOCKER="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER --user $(id -u):$(id -g) ${{ matrix.builder-image }}"
export DOCKER_ROOT="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER ${{ matrix.builder-image }}"
docker pull ${{ matrix.builder-image }}
echo =====
${DOCKER} ccache -s
echo =====
${DOCKER} sccache -s
echo =====
mkdir build
${DOCKER} bash -c "cd build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_RELEASE_WASM=yes -DBUILD_DEBUG_WASM=yes -DBUILD_DOC=yes -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache .."
echo =====
${DOCKER} bash -c "cd build && make -j $(nproc)"
echo =====
${DOCKER} bash -c "cd build && ctest --output-on-failure -j $(nproc)"
echo =====
ls -la ${GITHUB_WORKSPACE}
ls -la ${GITHUB_WORKSPACE}/build/doc/psidk
echo =====
${DOCKER} ccache -s
echo =====
${DOCKER} sccache -s
echo =====
${DOCKER} bash -c "cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=psidk-ubuntu-${{ matrix.ubuntu-version }}"
echo =====
${DOCKER} bash -c "cd build && mv book psidk-book && tar czf ../psidk-book-${{ matrix.ubuntu-version }}.tar.gz psidk-book"
- name: Upload psidk-ubuntu-${{ matrix.ubuntu-version }}
uses: actions/upload-artifact@v1
with:
name: psidk-ubuntu-${{ matrix.ubuntu-version }}
path: build/psidk-ubuntu-${{ matrix.ubuntu-version }}.tar.gz
- name: Upload psidk-book-${{ matrix.ubuntu-version }}
uses: actions/upload-artifact@v1
with:
name: psidk-book-${{ matrix.ubuntu-version }}
path: psidk-book-${{ matrix.ubuntu-version }}.tar.gz