Remove DATADIR_ROLLBACK after log generation (#3077) #10
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 - Dev | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "!v*" | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
env: | |
BUILD_VERSION: latest # Computed | |
DOCKER_HUB_USER: defi | |
# Note: We do not use debug build on CI for dev as well, since debug builds | |
# take 5x the amount of space and run the GitHub CI workers out of space. | |
# make.sh still defaults to debug for local builds | |
MAKE_DEBUG: 0 | |
GIT_VERSION: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64-pc-linux-gnu, x86_64-w64-mingw32, x86_64-apple-darwin] | |
include: | |
- container: defi/ain-builder:latest | |
- target: x86_64-w64-mingw32 | |
container: defi/ain-win-builder:latest | |
container: | |
image: ${{ matrix.container }} | |
env: | |
TARGET: ${{matrix.target}} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git config --global --add safe.directory '*' | |
- name: Populate environment | |
run: ./make.sh ci-export-vars | |
- name: Setup dependencies | |
run: ./make.sh ci-setup-deps | |
- name: Setup user dependencies | |
run: ./make.sh ci-setup-user-deps | |
- name: Restore cpp build cache | |
id: cpp-cache-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
./build/depends | |
./build/src | |
~/.ccache | |
key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }} | |
- name: Rust build cache | |
uses: Swatinem/rust-cache@v2 | |
id: rust-cache-restore | |
with: | |
workspaces: lib -> ../build/lib/target | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
shared-key: ${{ env.TARGET }} | |
- name: Build and package | |
run: ./make.sh release | |
- name: Publish artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }} | |
path: ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} | |
- name: Delete previous cpp build cache | |
if: ${{ github.ref == 'refs/heads/master' && steps.cpp-cache-restore.outputs.cache-hit }} | |
continue-on-error: true | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete "cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }}" --confirm | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save cpp build cache | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
./build/depends | |
./build/src | |
~/.ccache | |
key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }} | |
docker-build: | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
TARGET: x86_64-pc-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Populate environment | |
run: ./make.sh ci-export-vars | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }} | |
path: ./build/ | |
- name: Unpack binaries | |
run: tar -xvzf ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} -C ./build/ | |
- name: Build defi image | |
run: rm .dockerignore && ./make.sh docker-build-from-binaries | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Push to Docker Hub | |
run: | | |
set -e; ver=${{ env.BUILD_VERSION }} | |
docker tag defichain-${{ env.TARGET }}:${ver} defi/defichain:${ver} | |
docker push defi/defichain:${ver} |