From 06d30e50bb3916143af05abd840cacae18075fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Wed, 17 Jan 2024 03:40:26 +0100 Subject: [PATCH] WIP --- .github/workflows/build_deploy.yml | 134 +++++++++++++++++++---------- ci/build-artifacts.sh | 5 ++ docker/node/Dockerfile | 5 +- 3 files changed, 94 insertions(+), 50 deletions(-) create mode 100644 ci/build-artifacts.sh diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index 24de26309f..37bd5e113f 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -1,22 +1,24 @@ name: Build & Deploy + on: schedule: - cron: "0 0 * * 3,6" workflow_dispatch: -env: - artifact: 1 +# env: +# artifact: 1 jobs: prepare_build: + name: Prepare Build runs-on: ubuntu-22.04 outputs: CI_TAG: ${{ steps.tag_set.outputs.CI_TAG }} TAG_CREATED: ${{ steps.tag_set.outputs.tag_created }} steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - ref: ${{ github.ref }} + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + - name: Set the tag and version id: tag_set run: | @@ -29,67 +31,80 @@ jobs: env: GITHUB_ACTOR: ${{ github.actor }} - - osx_job: + osx_build: + name: OSX [${{ matrix.NETWORK }}] needs: prepare_build if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} runs-on: macOS-12 timeout-minutes: 90 strategy: matrix: - network: ["TEST", "BETA", "LIVE"] + include: + - { NETWORK: TEST, BUILD_TYPE: "RelWithDebInfo" } + - { NETWORK: BETA, BUILD_TYPE: "RelWithDebInfo" } + - { NETWORK: LIVE, BUILD_TYPE: "Release" } + env: + NANO_NETWORK: ${{ matrix.NETWORK }} + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} steps: - - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} - repository: ${{ github.repository }} + # ref: ${{ needs.prepare_build.outputs.CI_TAG }} + - name: Prepare run: ci/prepare/macos/prepare.sh - - name: Build Artifact - run: ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; + + - name: Build Artifacts + run: ci/build-artifacts.sh env: - NETWORK: ${{ matrix.network }} CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} - - name: Deploy Artifact + + - name: Deploy Artifacts run: ci/actions/deploy.sh env: - NETWORK: ${{ matrix.network }} TAG: ${{ needs.prepare_build.outputs.CI_TAG }} S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-east-2 - - linux_job: + linux_build: + name: Linux [${{ matrix.NETWORK }}] needs: prepare_build if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} runs-on: ubuntu-22.04 timeout-minutes: 90 strategy: matrix: - network: ["TEST", "BETA", "LIVE"] + # network: ["TEST", "BETA", "LIVE"] + include: + - { network: TEST, build_type: "RelWithDebInfo" } + - { network: BETA, build_type: "RelWithDebInfo" } + - { network: LIVE, build_type: "Release" } + env: + NANO_NETWORK: ${{ matrix.network }} + BUILD_TYPE: ${{ matrix.build_type }} steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} - repository: ${{ github.repository }} + # ref: ${{ needs.prepare_build.outputs.CI_TAG }} + - name: Prepare run: sudo -E ci/prepare/linux/prepare.sh - - name: Build Artifact - run: ci/build-deploy.sh "/usr/lib/x86_64-linux-gnu/cmake/Qt5" + + - name: Build Artifacts + run: ci/build-artifacts.sh env: - NETWORK: ${{ matrix.network }} CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} - - name: Deploy Artifact + - name: Deploy Artifacts run: ci/actions/deploy.sh env: - NETWORK: ${{ matrix.network }} TAG: ${{ needs.prepare_build.outputs.CI_TAG }} S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }} @@ -97,8 +112,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-east-2 - - linux_rpm_job: + linux_rpm_build: needs: prepare_build if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} runs-on: ubuntu-22.04 @@ -107,18 +121,22 @@ jobs: matrix: network: ["BETA", "LIVE"] #No path to build TEST exists ci/build-rhel.sh steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" ref: "develop" #build-rhel.sh needs develop branch and then sets the tag repository: ${{ github.repository }} + - name: Build local/nano-env:rhel run: ci/actions/linux/install_deps.sh env: COMPILER: rhel DOCKER_REGISTRY: local + - name: RockyLinux 8 Base run: ci/build-docker-image.sh docker/ci/Dockerfile-rhel local/nano-env:rhel + - name: Build Artifact run: | mkdir -p ${GITHUB_WORKSPACE}/artifacts @@ -142,30 +160,39 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-east-2 - - linux_docker_job: + docker_build: + name: Docker [${{ matrix.NETWORK }}] needs: prepare_build if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} runs-on: ubuntu-22.04 timeout-minutes: 90 strategy: matrix: - network: ["TEST", "BETA", "LIVE"] + # network: ["TEST", "BETA", "LIVE"] + include: + - { network: TEST, build_type: "RelWithDebInfo" } + - { network: BETA, build_type: "RelWithDebInfo" } + - { network: LIVE, build_type: "Release" } + env: + NANO_NETWORK: ${{ matrix.network }} + BUILD_TYPE: ${{ matrix.build_type }} steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} - repository: ${{ github.repository }} + # ref: ${{ needs.prepare_build.outputs.CI_TAG }} + - name: Build Docker - run: ci/actions/linux/docker-build.sh + run: ci/build-docker.sh env: - NETWORK: ${{ matrix.network }} CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} + - name: Check if secrets.DOCKER_PASSWORD exists run: echo "DOCKER_PASSWORD_EXISTS=${{ secrets.DOCKER_PASSWORD != '' }}" >> $GITHUB_ENV - - name: Deploy Docker Hub + + - name: Deploy Docker (Hub) if: env.DOCKER_PASSWORD_EXISTS == 'true' run: ci/actions/linux/docker-deploy.sh env: @@ -174,6 +201,7 @@ jobs: DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} DOCKER_USER: ${{ vars.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + - name: Deploy Docker (ghcr.io) run: ci/actions/linux/ghcr-deploy.sh env: @@ -183,29 +211,41 @@ jobs: DOCKER_USER: ${{ github.repository_owner }} DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - windows_job: + windows_build: + name: Windows [${{ matrix.network }}] needs: prepare_build if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} runs-on: windows-latest timeout-minutes: 90 strategy: matrix: - network: ["TEST", "BETA", "LIVE"] + # network: ["TEST", "BETA", "LIVE"] + include: + - { network: TEST, build_type: "RelWithDebInfo" } + - { network: BETA, build_type: "RelWithDebInfo" } + - { network: LIVE, build_type: "Release" } + env: + NANO_NETWORK: ${{ matrix.network }} + BUILD_TYPE: ${{ matrix.build_type }} steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" ref: ${{ needs.prepare_build.outputs.CI_TAG }} repository: ${{ github.repository }} + - name: Prepare run: ci/prepare/windows/prepare.ps1 - - name: Build Artifact - run: ci/actions/windows/build.ps1 + + - name: Build Artifacts + run: ci/build-artifacts.sh + shell: bash env: CSC_LINK: ${{ secrets.CSC_LINK }} CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - - name: Deploy Artifact + + - name: Deploy Artifacts run: ci/actions/windows/deploy.ps1 env: NETWORK: ${{ matrix.network }} diff --git a/ci/build-artifacts.sh b/ci/build-artifacts.sh new file mode 100644 index 0000000000..c0fd6d80c3 --- /dev/null +++ b/ci/build-artifacts.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euox pipefail + +NANO_GUI=ON \ +$(dirname "$BASH_SOURCE")/build.sh package \ No newline at end of file diff --git a/docker/node/Dockerfile b/docker/node/Dockerfile index 0c36f545c8..4f1e2ba5fd 100644 --- a/docker/node/Dockerfile +++ b/docker/node/Dockerfile @@ -10,14 +10,13 @@ RUN /tmp/prepare/prepare.sh COPY ./ /tmp/src WORKDIR /tmp/src -#Define ARGs for ci/build-node.sh +# Define ARGs for ci/build-node.sh ARG BUILD_TYPE=RelWithDebInfo ARG NANO_TEST=OFF ARG COVERAGE=OFF -ARG CMAKE_SANITIZER="" +ARG SANITIZER ARG CI_TAG=DEV_BUILD ARG CI_VERSION_PRE_RELEASE=OFF -ARG SANITIZER # Build node RUN ci/build-node.sh