diff --git a/.github/workflows/artifacts_build_deploy.yml b/.github/workflows/artifacts_build_deploy.yml new file mode 100644 index 0000000000..ae10aa4835 --- /dev/null +++ b/.github/workflows/artifacts_build_deploy.yml @@ -0,0 +1,221 @@ +name: All (Live Beta Test) +on: + schedule: + - cron: "0 0 * * 3,6" + workflow_dispatch: + inputs: + increment: + description: "increment version_minor (releases/v{} branch) or version_pre_release (all other branches)" + default: "1" + required: true +env: + artifact: 1 + +jobs: + prepare_build: + runs-on: ubuntu-20.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: Set the tag and version + id: tag_set + run: | + output_var_file="variable_list.txt" + ci/actions/generate_next_git_tag.sh -c -o "${output_var_file} -i ${{ github.event.inputs.increment }}" + CI_TAG=$(grep 'build_tag' ${output_var_file} | cut -d= -f2) + echo "CI_TAG=${CI_TAG}" >> $GITHUB_OUTPUT + TAG_CREATED=$(grep 'tag_created' ${output_var_file} | cut -d= -f2) + echo "TAG_CREATED=${TAG_CREATED}" >> $GITHUB_OUTPUT + env: + GITHUB_ACTOR: ${{ github.actor }} + + + osx_job: + needs: prepare_build + if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + runs-on: macOS-12 + timeout-minutes: 90 + strategy: + matrix: + network: ["TEST", "BETA", "LIVE"] + steps: + + - 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/macos/prepare.sh + - name: Build Artifact + run: ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; + env: + NETWORK: ${{ matrix.network }} + CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + - name: Deploy Artifact + 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: + 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"] + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + with: + submodules: "recursive" + ref: ${{ needs.prepare_build.outputs.CI_TAG }} + repository: ${{ github.repository }} + - 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" + env: + NETWORK: ${{ matrix.network }} \ + CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} \ + + - name: Deploy Artifact + 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_rpm_job: + needs: prepare_build + if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + runs-on: ubuntu-22.04 + timeout-minutes: 90 + strategy: + matrix: + network: ["BETA", "LIVE"] #No path to build TEST exists ci/build-rhel.sh + steps: + - 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 + docker run -v ${GITHUB_WORKSPACE}:/workspace -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \ + local/nano-env:rhel /bin/bash -c " \ + NETWORK=${{ matrix.network }} \ + TAG=${{ needs.prepare_build.outputs.CI_TAG }} \ + REPO_TO_BUILD=${{ github.repository }} \ + RPM_RELEASE=1 \ + ci/build-rhel.sh" + + - name: Deploy Artifacts + run: ci/actions/deploy.sh + env: + LINUX_RPM: 1 + NETWORK: ${{ matrix.network }} + # TAG: ${{ needs.prepare_build.outputs.CI_TAG }} # (not used in the deploy script if LINUX_RPM==1 ) + 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_docker_job: + 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"] + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 + with: + submodules: "recursive" + ref: ${{ needs.prepare_build.outputs.CI_TAG }} + repository: ${{ github.repository }} + - name: Build Docker + run: ci/actions/linux/docker-build.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 + if: env.DOCKER_PASSWORD_EXISTS == 'true' + run: ci/actions/linux/docker-deploy.sh + env: + CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + NETWORK: ${{ matrix.network }} + 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: + CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + NETWORK: ${{ matrix.network }} + DOCKER_REGISTRY: ghcr.io + DOCKER_USER: ${{ github.repository_owner }} + DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + + + windows_job: + needs: prepare_build + if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + runs-on: windows-latest + timeout-minutes: 90 + strategy: + matrix: + network: ["TEST", "BETA", "LIVE"] + steps: + - 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 + env: + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + - name: Deploy Artifact + run: ci/actions/windows/deploy.ps1 + 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 diff --git a/.github/workflows/beta_artifacts.yml b/.github/workflows/beta_artifacts.yml deleted file mode 100644 index 6f35fadeaf..0000000000 --- a/.github/workflows/beta_artifacts.yml +++ /dev/null @@ -1,205 +0,0 @@ -name: Beta -on: - schedule: - - cron: "0 0 * * 3,6" - workflow_dispatch: - inputs: - repo: - description: "repo" - default: "nanocurrency/nano-node" - required: true - ref: - description: "tag to build" - default: "develop" - required: true -env: - BETA: 1 - artifact: 1 - -jobs: - build_auto_setup_job: - if: ${{ github.event.inputs.ref == '' }} - runs-on: ubuntu-20.04 - outputs: - build_tag: ${{ steps.tag_gen.outputs.build_tag }} - build_number: ${{ steps.tag_gen.outputs.build_number }} - steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - ref: "develop" - repository: "nanocurrency/nano-node" - - name: Fetch the repository tags - run: | - git fetch --tags - - name: Generate the new tag - id: tag_gen - run: | - output_var_file="variable_list.txt" - ci/actions/dev-build-tag-gen.sh -o "${output_var_file}" - cat "${output_var_file}" - cat "${output_var_file}" >> $GITHUB_OUTPUT - - name: Push the new tag - run: | - # Set the tag locally - TAG="${{ steps.tag_gen.outputs.build_tag }}" - # Set git configuration - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - # Create and push the tag - git tag -a "${TAG}" -m "This tag was automatically generated by the Beta workflow" - git push origin "${TAG}" - - osx_job: - if: ${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.result == 'success' && always() || github.event.inputs.ref != '' && always() }} - needs: build_auto_setup_job - runs-on: macOS-12 - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/osx/install_deps.sh - - name: Build Artifact - run: CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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: - if: ${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.result == 'success' && always() || github.event.inputs.ref != '' && always() }} - needs: build_auto_setup_job - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Artifact - run: docker run -v ${GITHUB_WORKSPACE}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && BETA=1 CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/build-deploy.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5" - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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_rpm_job: - if: ${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.result == 'success' && always() || github.event.inputs.ref != '' && always() }} - needs: build_auto_setup_job - runs-on: ubuntu-22.04 - timeout-minutes: 90 - steps: - - name: Sets the tag and repo variables (to build) - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - echo "REPO_TO_BUILD=${{ github.event.inputs.repo }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.ref }} - repository: ${{ github.repository }} - - name: RockyLinux 8 Base - run: ci/build-docker-image.sh docker/ci/Dockerfile-rhel nanocurrency/nano-env:rhel - - name: Build Artifact - run: | - mkdir -p ${GITHUB_WORKSPACE}/artifacts - docker run -e BETA=1 -e TAG=$TAG -e REPO_TO_BUILD=$REPO_TO_BUILD -e RPM_RELEASE=1 \ - -v ${GITHUB_WORKSPACE}:/workspace \ - -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \ - nanocurrency/nano-env:rhel /bin/bash -c "ci/build-rhel.sh" - - name: Deploy Artifacts - run: ci/actions/deploy.sh - env: - LINUX_RPM: 1 - S3_BUILD_DIRECTORY: ${{ secrets.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_docker_job: - if: ${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.result == 'success' && always() || github.event.inputs.ref != '' && always() }} - needs: build_auto_setup_job - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Docker (nanocurrency/nano-beta) - run: CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/actions/linux/docker-build.sh - - name: Deploy Docker Hub (nanocurrency/nano-beta) - if: ${{ github.repository == 'nanocurrency/nano-node' }} - run: CI_TAG=${TAG} ci/actions/linux/docker-deploy.sh - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to ghcr.io - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Deploy Docker (ghcr.io) - run: ci/actions/linux/ghcr_push.sh - - windows_job: - if: ${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.result == 'success' && always() || github.event.inputs.ref != '' && always() }} - needs: build_auto_setup_job - runs-on: windows-latest - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - Write-Output "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/windows/install_deps.ps1 - - name: Build Artifact - run: ci/actions/windows/build.ps1 - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - - name: Deploy Artifact - run: ci/actions/windows/deploy.ps1 - env: - S3_BUILD_DIRECTORY: ${{ secrets.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 diff --git a/.github/workflows/beta_artifacts_latest_release_branch.yml b/.github/workflows/beta_artifacts_latest_release_branch.yml deleted file mode 100644 index 7627a46e58..0000000000 --- a/.github/workflows/beta_artifacts_latest_release_branch.yml +++ /dev/null @@ -1,192 +0,0 @@ -name: Beta (Latest Release Branch) -on: - schedule: - - cron: "0 0 * * 3,6" -env: - BETA: 1 - artifact: 1 - -jobs: - build_auto_setup_job: - runs-on: ubuntu-20.04 - outputs: - build_tag: ${{ steps.tag_gen.outputs.build_tag }} - build_number: ${{ steps.tag_gen.outputs.build_number }} - release_branch: ${{ steps.tag_gen.outputs.release_branch }} - steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - ref: "develop" - repository: "nanocurrency/nano-node" - - name: Fetch the repository tags - run: | - git fetch --tags - - name: Generate the new tag - id: tag_gen - run: | - output_var_file="variable_list.txt" - ci/actions/dev-build-tag-gen.sh -r -o "${output_var_file}" - cat "${output_var_file}" - cat "${output_var_file}" >> $GITHUB_OUTPUT - - name: Push the new tag - run: | - # Set the tag locally - TAG="${{ steps.tag_gen.outputs.build_tag }}" - # Set git configuration - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - # Set to the specified release branch - git checkout origin/${{ steps.tag_gen.outputs.release_branch }} -b ${{ steps.tag_gen.outputs.release_branch }} - # Create and push the tag - git tag -a "${TAG}" -m "This tag was automatically generated by the Beta workflow" - git push origin "${TAG}" - - osx_job: - needs: build_auto_setup_job - runs-on: macOS-12 - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/osx/install_deps.sh - - name: Build Artifact - run: CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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: - needs: build_auto_setup_job - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Artifact - run: docker run -v ${GITHUB_WORKSPACE}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && BETA=1 CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/build-deploy.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5" - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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_rpm_job: - needs: build_auto_setup_job - runs-on: ubuntu-22.04 - timeout-minutes: 90 - steps: - - name: Sets the tag and repo variables (to build) - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - echo "REPO_TO_BUILD=${{ github.event.inputs.repo }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.ref }} - repository: ${{ github.repository }} - - name: RockyLinux 8 Base - run: ci/build-docker-image.sh docker/ci/Dockerfile-rhel nanocurrency/nano-env:rhel - - name: Build Artifact - run: | - mkdir -p ${GITHUB_WORKSPACE}/artifacts - docker run -e BETA=1 -e TAG=$TAG -e REPO_TO_BUILD=$REPO_TO_BUILD -e RPM_RELEASE=1 \ - -v ${GITHUB_WORKSPACE}:/workspace \ - -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \ - nanocurrency/nano-env:rhel /bin/bash -c "ci/build-rhel.sh" - - name: Deploy Artifacts - run: ci/actions/deploy.sh - env: - LINUX_RPM: 1 - S3_BUILD_DIRECTORY: ${{ secrets.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_docker_job: - needs: build_auto_setup_job - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV - echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Docker (nanocurrency/nano-beta) - run: CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/actions/linux/docker-build.sh - - name: Deploy Docker Hub (nanocurrency/nano-beta) - if: ${{ github.repository == 'nanocurrency/nano-node' }} - run: CI_TAG=${TAG} ci/actions/linux/docker-deploy.sh - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to ghcr.io - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Deploy Docker (ghcr.io) - run: ci/actions/linux/ghcr_push.sh - - windows_job: - needs: build_auto_setup_job - runs-on: windows-latest - timeout-minutes: 90 - steps: - - name: Set the tag and the pre-release version - run: | - Write-Output "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ env.TAG }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/windows/install_deps.ps1 - - name: Build Artifact - run: ci/actions/windows/build.ps1 - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - - name: Deploy Artifact - run: ci/actions/windows/deploy.ps1 - env: - S3_BUILD_DIRECTORY: ${{ secrets.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 diff --git a/.github/workflows/code_sanitizers.yml b/.github/workflows/code_sanitizers.yml index 616768662e..a6797ff25c 100644 --- a/.github/workflows/code_sanitizers.yml +++ b/.github/workflows/code_sanitizers.yml @@ -16,7 +16,7 @@ jobs: TEST_USE_ROCKSDB: [0, 1] COMPILER: [clang] SANITIZER: [ASAN, ASAN_INT, TSAN] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: issue_reported: ${{ steps.show_report.outputs.issue_reported }} env: @@ -41,17 +41,17 @@ jobs: run: ci/actions/linux/install_deps.sh - name: Build Tests id: build_tests - run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c \ - "cd /workspace && ${{ matrix.SANITIZER }}=1 ./ci/build-ci.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 'core_test rpc_test'" + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c \ + "cd /workspace && ${{ matrix.SANITIZER }}=1 ci/build-ci.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 'core_test rpc_test'" - name: Run core_test id: core_test continue-on-error: true - run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c \ + run: docker run -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c \ "cd /workspace/build && ${XSAN}_OPTIONS=${XSAN_SUPPRESSIONS}log_exe_name=1:log_path=sanitizer_report ./core_test" - name: Run rpc_test id: rpc_test continue-on-error: true - run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c \ + run: docker run -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c \ "cd /workspace/build && ${XSAN}_OPTIONS=${XSAN_SUPPRESSIONS}log_exe_name=1:log_path=sanitizer_report ./rpc_test" - name: Test Reports id: show_report @@ -63,7 +63,7 @@ jobs: echo "Report Output:" for report in ${reports}; do echo "File: $report" - docker run -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cat /workspace/${report}" + docker run -v ${PWD}:/workspace ghcr.io/${{ github.repository }}/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cat /workspace/${report}" echo done issue_reported=true diff --git a/.github/workflows/develop_branch_dockers_deploy.yml b/.github/workflows/develop_branch_dockers_deploy.yml index a0109415fb..f69ee795be 100644 --- a/.github/workflows/develop_branch_dockers_deploy.yml +++ b/.github/workflows/develop_branch_dockers_deploy.yml @@ -7,22 +7,25 @@ on: jobs: linux_job: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - name: Fetch Deps run: ci/actions/linux/install_deps.sh - - name: Login to ghcr.io - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - name: Deploy Docker (ghcr.io) - run: ci/actions/linux/ghcr_push.sh + run: ci/actions/linux/ghcr-deploy-env.sh + env: + DOCKER_REGISTRY: ghcr.io + DOCKER_USER: ${{ github.repository_owner }} + DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + - name: Check if secrets.DOCKER_PASSWORD exists + run: echo "DOCKER_PASSWORD_EXISTS=${{ secrets.DOCKER_PASSWORD != '' }}" >> $GITHUB_ENV - name: Deploy Docker (nanocurrency/nano-env) - run: ci/actions/linux/docker-deploy.sh + if: env.DOCKER_PASSWORD_EXISTS == 'true' + run: ci/actions/linux/docker-deploy-env.sh env: + DOCKER_HUB: ${{ secrets.DOCKER_HUB }} + DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/.github/workflows/live_artifacts.yml b/.github/workflows/live_artifacts.yml deleted file mode 100644 index d5fa7df57c..0000000000 --- a/.github/workflows/live_artifacts.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Live -on: - workflow_dispatch: - inputs: - repo: - description: "repo" - default: "nanocurrency/nano-node" - required: true - ref: - description: "tag to build" - default: "develop" - required: true -env: - artifact: 1 - -jobs: - osx_job: - runs-on: macOS-12 - timeout-minutes: 90 - steps: - - name: tag - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/osx/install_deps.sh - - name: Build Artifact - run: CI_TAG=${TAG} ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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: - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: tag - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Artifact - run: docker run -v ${GITHUB_WORKSPACE}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && CI_TAG=${TAG} ci/build-deploy.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5" - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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_rpm_job: - runs-on: ubuntu-22.04 - timeout-minutes: 90 - steps: - - name: Sets the tag and repo variables (to build) - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - echo "REPO_TO_BUILD=${{ github.event.inputs.repo }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.ref }} - repository: ${{ github.repository }} - - name: RockyLinux 8 Base - run: ci/build-docker-image.sh docker/ci/Dockerfile-rhel nanocurrency/nano-env:rhel - - name: Build Artifact - run: | - mkdir -p ${GITHUB_WORKSPACE}/artifacts - docker run -e LIVE=1 -e TAG=$TAG -e REPO_TO_BUILD=$REPO_TO_BUILD -e RPM_RELEASE=1 \ - -v ${GITHUB_WORKSPACE}:/workspace \ - -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \ - nanocurrency/nano-env:rhel /bin/bash -c "ci/build-rhel.sh" - - name: Deploy Artifacts - run: ci/actions/deploy.sh - env: - LINUX_RPM: 1 - S3_BUILD_DIRECTORY: ${{ secrets.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_docker_job: - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: tag - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Docker (nanocurrency/nano) - run: CI_TAG=${TAG} ci/actions/linux/docker-build.sh - - name: Deploy Docker Hub (nanocurrency/nano) - if: ${{ github.repository == 'nanocurrency/nano-node' }} - run: CI_TAG=${TAG} ci/actions/linux/docker-deploy.sh - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to ghcr.io - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Deploy Docker (ghcr.io) - run: ci/actions/linux/ghcr_push.sh - - windows_job: - runs-on: windows-latest - timeout-minutes: 90 - steps: - - name: tag - run: | - Write-Output "TAG=${{ github.event.inputs.ref }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/windows/install_deps.ps1 - - name: Build Artifact - run: ci/actions/windows/build.ps1 - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - - name: Deploy Artifact - run: ci/actions/windows/deploy.ps1 - env: - S3_BUILD_DIRECTORY: ${{ secrets.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 diff --git a/.github/workflows/test_network_artifacts.yml b/.github/workflows/test_network_artifacts.yml deleted file mode 100644 index 2969877691..0000000000 --- a/.github/workflows/test_network_artifacts.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: Test -on: - workflow_dispatch: - inputs: - repo: - description: "repo" - default: "nanocurrency/nano-node" - required: true - ref: - description: "tag to build" - default: "develop" - required: true -env: - artifact: 1 - TEST: 1 - -jobs: - osx_job: - runs-on: macOS-12 - timeout-minutes: 90 - steps: - - name: tag - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/osx/install_deps.sh - - name: Build Artifact - run: CI_TAG=${TAG} ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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: - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: tag - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Artifact - run: docker run -e TEST -v ${GITHUB_WORKSPACE}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && CI_TAG=${TAG} ci/build-deploy.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5" - - name: Deploy Artifact - run: ci/actions/deploy.sh - env: - S3_BUILD_DIRECTORY: ${{ secrets.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_docker_job: - runs-on: ubuntu-20.04 - timeout-minutes: 90 - steps: - - name: tag - run: | - echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - env: - COMPILER: gcc - run: ci/actions/linux/install_deps.sh - - name: Build Docker (nanocurrency/nano) - run: CI_TAG=${TAG} ci/actions/linux/docker-build.sh - - name: Deploy Docker Hub (nanocurrency/nano-test) - if: ${{ github.repository == 'nanocurrency/nano-node' }} - run: CI_TAG=${TAG} ci/actions/linux/docker-deploy.sh - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to ghcr.io - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Deploy Docker (ghcr.io) - run: ci/actions/linux/ghcr_push.sh - - windows_job: - runs-on: windows-latest - timeout-minutes: 90 - steps: - - name: tag - run: | - Write-Output "TAG=${{ github.event.inputs.ref }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - submodules: "recursive" - ref: ${{ github.event.inputs.ref }} - repository: ${{ github.event.inputs.repo }} - - name: Fetch Deps - run: ci/actions/windows/install_deps.ps1 - - name: Build Artifact - run: ci/actions/windows/build.ps1 - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - - name: Deploy Artifact - run: ci/actions/windows/deploy.ps1 - env: - S3_BUILD_DIRECTORY: ${{ secrets.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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 162b33d5c0..f3e9c3c316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,6 @@ execute_process( OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) -option(CI_BUILD false) option(CI_VERSION_PRE_RELEASE false) set(COVERAGE @@ -38,18 +37,19 @@ if(MSVC) add_definitions(/MP) endif() +set(CPACK_PACKAGE_VENDOR "Nano Currency") set(CPACK_PACKAGE_VERSION_MAJOR "26") set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") -if(CI_BUILD AND CI_VERSION_PRE_RELEASE) + +if(CI_VERSION_PRE_RELEASE) set(CPACK_PACKAGE_VERSION_PRE_RELEASE "${CI_VERSION_PRE_RELEASE}") else() set(CPACK_PACKAGE_VERSION_PRE_RELEASE "99") endif() -set(CPACK_PACKAGE_VENDOR "Nano Currency") -if(CI_BUILD) - set(TAG_VERSION_STRING "$ENV{CI_TAG}") +if(CI_TAG) + set(TAG_VERSION_STRING "${CI_TAG}") else() set(TAG_VERSION_STRING "V${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") diff --git a/ci/actions/deploy.sh b/ci/actions/deploy.sh index eed405e585..ac4b74c8d0 100755 --- a/ci/actions/deploy.sh +++ b/ci/actions/deploy.sh @@ -5,19 +5,22 @@ set -o nounset set -o xtrace OS=$(uname) IS_RPM_DEPLOY="${LINUX_RPM:-0}" +S3_BUCKET_NAME="${S3_BUCKET_NAME:-repo.nano.org}" -if [[ "${BETA:-0}" -eq 1 ]]; then +if [[ "${NETWORK}" == "BETA" ]]; then BUILD="beta" -elif [[ "${TEST:-0}" -eq 1 ]]; then +elif [[ "${NETWORK}" == "TEST" ]]; then BUILD="test" else BUILD="live" fi -if [[ "${GITHUB_REPOSITORY:-}" == "nanocurrency/nano-node" ]]; then - DIRECTORY=$BUILD -else +if [[ -n "${S3_BUILD_DIRECTORY}" ]]; then + + DIRECTORY="${S3_BUILD_DIRECTORY}/${BUILD}" +else + DIRECTORY=$BUILD fi if [[ "$OS" == 'Linux' && "$IS_RPM_DEPLOY" -eq "1" ]]; then @@ -29,8 +32,8 @@ if [[ "$OS" == 'Linux' && "$IS_RPM_DEPLOY" -eq "1" ]]; then echo "Hash: $SHA" echo $SHA > ${GITHUB_WORKSPACE}/$(basename "${rpm}.sha256") - aws s3 cp ${rpm} s3://repo.nano.org/$DIRECTORY/binaries/$(basename "${rpm}") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers - aws s3 cp ${GITHUB_WORKSPACE}/$(basename "${rpm}.sha256") s3://repo.nano.org/$DIRECTORY/binaries/$(basename "${rpm}.sha256") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp ${rpm} s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/$(basename "${rpm}") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp ${GITHUB_WORKSPACE}/$(basename "${rpm}.sha256") s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/$(basename "${rpm}.sha256") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers done for srpm in $SRPMS; do @@ -38,8 +41,8 @@ if [[ "$OS" == 'Linux' && "$IS_RPM_DEPLOY" -eq "1" ]]; then echo "Hash: $SHA" echo $SHA > ${GITHUB_WORKSPACE}/$(basename "${srpm}).sha256") - aws s3 cp ${srpm} s3://repo.nano.org/$DIRECTORY/source/$(basename "${srpm}") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers - aws s3 cp ${GITHUB_WORKSPACE}/$(basename "${srpm}).sha256") s3://repo.nano.org/$DIRECTORY/source/$(basename "${srpm}.sha256") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp ${srpm} s3://${S3_BUCKET_NAME}/$DIRECTORY/source/$(basename "${srpm}") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp ${GITHUB_WORKSPACE}/$(basename "${srpm}).sha256") s3://${S3_BUCKET_NAME}/$DIRECTORY/source/$(basename "${srpm}.sha256") --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers done elif [[ "$OS" == 'Linux' ]]; then SHA=$(sha256sum $GITHUB_WORKSPACE/build/nano-node-*-Linux.tar.bz2) @@ -50,15 +53,15 @@ elif [[ "$OS" == 'Linux' ]]; then echo "Hash: $SHA" echo $SHA >$GITHUB_WORKSPACE/nano-node-$TAG-Linux.deb.sha256 - aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Linux.tar.bz2 s3://repo.nano.org/$DIRECTORY/binaries/nano-node-$TAG-Linux.tar.bz2 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers - aws s3 cp $GITHUB_WORKSPACE/nano-node-$TAG-Linux.tar.bz2.sha256 s3://repo.nano.org/$DIRECTORY/binaries/nano-node-$TAG-Linux.tar.bz2.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers - aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Linux.deb s3://repo.nano.org/$DIRECTORY/binaries/nano-node-$TAG-Linux.deb --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers - aws s3 cp $GITHUB_WORKSPACE/nano-node-$TAG-Linux.deb.sha256 s3://repo.nano.org/$DIRECTORY/binaries/nano-node-$TAG-Linux.deb.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Linux.tar.bz2 s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Linux.tar.bz2 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp $GITHUB_WORKSPACE/nano-node-$TAG-Linux.tar.bz2.sha256 s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Linux.tar.bz2.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Linux.deb s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Linux.deb --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp $GITHUB_WORKSPACE/nano-node-$TAG-Linux.deb.sha256 s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Linux.deb.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers else SHA=$(sha256sum $GITHUB_WORKSPACE/build/nano-node-*-Darwin.dmg) echo "Hash: $SHA" echo $SHA >$GITHUB_WORKSPACE/build/nano-node-$TAG-Darwin.dmg.sha256 - aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Darwin.dmg s3://repo.nano.org/$DIRECTORY/binaries/nano-node-$TAG-Darwin.dmg --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers - aws s3 cp $GITHUB_WORKSPACE/build/nano-node-$TAG-Darwin.dmg.sha256 s3://repo.nano.org/$DIRECTORY/binaries/nano-node-$TAG-Darwin.dmg.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp $GITHUB_WORKSPACE/build/nano-node-*-Darwin.dmg s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Darwin.dmg --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers + aws s3 cp $GITHUB_WORKSPACE/build/nano-node-$TAG-Darwin.dmg.sha256 s3://${S3_BUCKET_NAME}/$DIRECTORY/binaries/nano-node-$TAG-Darwin.dmg.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers fi diff --git a/ci/actions/generate_next_git_tag.sh b/ci/actions/generate_next_git_tag.sh new file mode 100755 index 0000000000..503a4eaa03 --- /dev/null +++ b/ci/actions/generate_next_git_tag.sh @@ -0,0 +1,199 @@ +#!/bin/bash + +# This script creates the next tag for the current branch by incrementing the version_pre_release by 1 +# A new tag is only created if a new commit has been detected compared to the previous tag. +# The tag has the following format V${current_version_major}.${current_version_minor}${branch_name} +# ${branch_name} is converted to "DB" if the script operates on develop branch. (e.g first tag for V26: V26.0DB1) +# if -c flag is provided, version_pre_release in CMakeLists.txt is incremented and a new tag is created and pushed to origin +# if -o is provided, "build_tag" , "version_pre_release" and "tag_created" are written to file +# -i flag defines the incrementing. If the script runs on a "releases/v{Major}" branch, it increments minor_version. +# for all other non release branches it increments pre_release_vesrion. + +#!/bin/bash + +set -e +output="" +create=false +tag_created="false" +increment=1 + +while getopts ":o:ci:" opt; do + case ${opt} in + o ) + output=$OPTARG + ;; + c ) + create=true + ;; + i ) + increment=$OPTARG + ;; + \? ) + echo "Invalid Option: -$OPTARG" 1>&2 + exit 1 + ;; + : ) + echo "Invalid Option: -$OPTARG requires an argument" 1>&2 + exit 1 + ;; + esac +done +shift $((OPTIND -1)) + + +get_tag_suffix() { + local branch_name=$1 + local version_major=$2 + local tag_suffix=${branch_name//[^a-zA-Z0-9]/_} + + if [[ "$branch_name" == "develop" ]]; then + tag_suffix="DB" + fi + + echo $tag_suffix +} + +get_next_tag_number() { + local last_tag_number=$1 + local increment=$2 + echo $((last_tag_number + increment)) +} + +get_next_minor_version() { + local current_minor=$1 + local increment=$2 + echo $((current_minor + increment)) +} + +get_new_release_tag() { + local version_major=$1 + local next_minor=$2 + echo "V${version_major}.${next_minor}" +} + +get_new_other_tag() { + local base_version=$1 + local next_tag_number=$2 + echo "${base_version}${next_tag_number}" +} + +update_output_file() { + local new_tag=$1 + local next_number=$2 + local tag_created=$3 + local tag_type=$4 + + if [[ -n "$output" ]]; then + echo "build_tag =$new_tag" > $output + echo "$tag_type =$next_number" >> $output + echo "tag_created =$tag_created" >> $output + fi +} + +update_cmake_lists() { + local tag_type=$1 + local next_number=$2 + local variable_to_update="" + + if [[ "$tag_type" == "version_pre_release" ]]; then + variable_to_update="CPACK_PACKAGE_VERSION_PRE_RELEASE" + elif [[ "$tag_type" == "version_minor" ]]; then + variable_to_update="CPACK_PACKAGE_VERSION_MINOR" + fi + + if [[ -n "$variable_to_update" ]]; then + sed -i.bak "s/set(${variable_to_update} \"[0-9]*\")/set(${variable_to_update} \"${next_number}\")/g" CMakeLists.txt + rm CMakeLists.txt.bak + git add CMakeLists.txt + git commit -m "Update ${variable_to_update} to $next_number" + fi +} + +# Fetch all existing tags +git fetch --tags -f + +# Fetch the last commit hash of the current branch +current_commit_hash=$(git rev-parse HEAD) + +# Fetch branch name +branch_name=$(git rev-parse --abbrev-ref HEAD) + +# Fetch major and minor version numbers from CMakeLists.txt +current_version_major=$(grep "CPACK_PACKAGE_VERSION_MAJOR" CMakeLists.txt | grep -o "[0-9]\+") +current_version_minor=$(grep "CPACK_PACKAGE_VERSION_MINOR" CMakeLists.txt | grep -o "[0-9]\+") + +# Initialize tag suffix and next number +tag_suffix="" +next_number=0 + +if [[ "$branch_name" == "releases/v$current_version_major" ]]; then + + tag_type="version_minor" + # Find existing tags for the release branch + existing_release_tags=$(git tag --list "V${current_version_major}.*" | grep -E "V${current_version_major}\.[0-9]+$") + + # Check if any tag exists for the release branch + if [[ -z "$existing_release_tags" ]]; then + # No tag exists yet, use current minor version without incrementing + tag_created="true" + new_tag=$(get_new_release_tag $current_version_major $current_version_minor) + else + # Some tags already exist, increment the minor version with the defined $increment + tag_created="true" + next_number=$(get_next_minor_version $current_version_minor $increment) + new_tag=$(get_new_release_tag $current_version_major $next_number) + fi +else + # Non-release branches handling + tag_type="version_pre_release" + + tag_suffix=$(get_tag_suffix $branch_name $current_version_major) + base_version="V${current_version_major}.${current_version_minor}${tag_suffix}" + existing_tags=$(git tag --list "${base_version}*" | grep -E "${base_version}[0-9]+$") + last_tag_number=0 + + if [[ -n "$existing_tags" ]]; then + last_tag=$(echo "$existing_tags" | sort -V | tail -n1) + last_tag_number=$(echo "$last_tag" | awk -F"${tag_suffix}" '{print $2}') + last_tag_commit_hash=$(git rev-list -n 2 $last_tag | tail -n 1) + + if [[ "$current_commit_hash" == "$last_tag_commit_hash" ]]; then + echo "No new commits since the last tag. No new tag will be created." + tag_created="false" + else + tag_created="true" + next_number=$(get_next_tag_number $last_tag_number $increment) + new_tag=$(get_new_other_tag $base_version $next_number) + fi + else + tag_created="true" + next_number=1 + new_tag=$(get_new_other_tag $base_version $next_number) + fi +fi + +update_output_file $new_tag $next_number $tag_created $tag_type + +# Skip tag creation if no new commits +if [[ "$tag_created" == "true" ]]; then + echo "$new_tag" +else + exit 0 +fi + +if [[ $create == true ]]; then + # Stash current changes + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + + # Update variable in CMakeLists.txt + update_cmake_lists $tag_type $next_number + + # Create & Push the new tag + git tag -a "$new_tag" -m "This tag was created with generate_next_git_tag.sh" + git push origin "$new_tag" -f + + # Undo the last commit + git reset --hard HEAD~1 + echo "The tag $new_tag has been created and pushed, but the commit used for the tag does not exist on any branch." +fi \ No newline at end of file diff --git a/ci/actions/linux/docker-deploy-env.sh b/ci/actions/linux/docker-deploy-env.sh new file mode 100755 index 0000000000..d7392c0b98 --- /dev/null +++ b/ci/actions/linux/docker-deploy-env.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e +set -x + +source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh" + +docker_deploy_env diff --git a/ci/actions/linux/docker-impl/docker-common.sh b/ci/actions/linux/docker-impl/docker-common.sh index c61e144889..bcda39fbbd 100755 --- a/ci/actions/linux/docker-impl/docker-common.sh +++ b/ci/actions/linux/docker-impl/docker-common.sh @@ -1,34 +1,37 @@ #!/bin/bash - set -e set -a scripts="$PWD/ci" -CI_BRANCH=$(git branch | cut -f2 -d' ') +CI_BRANCH=$(git rev-parse --abbrev-ref HEAD) +DOCKER_REGISTRY="${DOCKER_REGISTRY:-nanocurrency}" +DOCKER_USER="${DOCKER_USER:-nanoreleaseteam}" tags=() + if [ -n "$CI_TAG" ]; then tags+=("$CI_TAG") elif [ -n "$CI_BRANCH" ]; then CI_TAG=$CI_BRANCH tags+=("$CI_BRANCH") fi -if [[ "$GITHUB_WORKFLOW" = "Live" ]]; then + + +if [[ "$NETWORK" = "LIVE" ]]; then echo "Live" network_tag_suffix='' network="live" -elif [[ "$GITHUB_WORKFLOW" = "Beta" ]]; then +elif [[ "$NETWORK" = "BETA" ]]; then echo "Beta" network_tag_suffix="-beta" network="beta" -elif [[ "$GITHUB_WORKFLOW" = "Test" ]]; then +elif [[ "$NETWORK" = "TEST" ]]; then echo "Test" network_tag_suffix="-test" network="test" fi -if [[ "$GITHUB_WORKFLOW" != "Develop Branch Dockers Deploy" ]]; then - docker_image_name="nanocurrency/nano${network_tag_suffix}" -fi +docker_image_name="${DOCKER_REGISTRY}/nano${network_tag_suffix}" +ghcr_image_name="ghcr.io/${GITHUB_REPOSITORY}/nano${network_tag_suffix}" docker_build() { @@ -37,44 +40,122 @@ docker_build() ci_version_pre_release="$CI_VERSION_PRE_RELEASE" fi - if [[ "$GITHUB_WORKFLOW" != "Develop Branch Dockers Deploy" ]]; then - ghcr_image_name="ghcr.io/${GITHUB_REPOSITORY}/nano${network_tag_suffix}" - "$scripts"/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg CI_VERSION_PRE_RELEASE="$ci_version_pre_release" --build-arg CI_TAG="$CI_TAG" - for tag in "${tags[@]}"; do - # Sanitize docker tag - # https://docs.docker.com/engine/reference/commandline/tag/ - tag="$(printf '%s' "$tag" | tr -c '[a-z][A-Z][0-9]_.-' -)" - if [ "$tag" != "latest" ]; then - docker tag "$docker_image_name" "${docker_image_name}:$tag" - docker tag "$ghcr_image_name" "${ghcr_image_name}:$tag" - fi - done + build_docker_image "$ci_version_pre_release" + + for tag in "${tags[@]}"; do + local sanitized_tag=$(sanitize_tag "$tag") + tag_docker_image "$sanitized_tag" + done +} + +build_docker_image() { + local ci_version_pre_release="$1" + "$scripts"/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" \ + --build-arg NANO_NETWORK="$network" \ + --build-arg CI_VERSION_PRE_RELEASE="$ci_version_pre_release" \ + --build-arg CI_TAG="$CI_TAG" +} + +sanitize_tag() { + local tag="$1" + # Sanitize docker tag + # https://docs.docker.com/engine/reference/commandline/tag/ + tag="$(printf '%s' "$tag" | tr -c '[a-z][A-Z][0-9]_.-' -)" + echo "$tag" +} + +tag_docker_image() { + local tag="$1" + if [ "$tag" != "latest" ]; then + docker tag "$docker_image_name" "${docker_image_name}:$tag" + docker tag "$ghcr_image_name" "${ghcr_image_name}:$tag" fi } + + docker_deploy() { - if [ -n "$DOCKER_PASSWORD" ]; then - echo "$DOCKER_PASSWORD" | docker login -u nanoreleaseteam --password-stdin - if [[ "$GITHUB_WORKFLOW" = "Develop Branch Dockers Deploy" ]]; then - "$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:base" - "$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:gcc" - "$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:clang" - echo "Deployed nano-env" - exit 0 - else - if [[ "$GITHUB_WORKFLOW" = "Live" ]]; then - tags=$(docker images --format '{{.Repository}}:{{.Tag }}' | grep nanocurrency | grep -vE "env|ghcr.io|none|latest") - else - tags=$(docker images --format '{{.Repository}}:{{.Tag }}' | grep nanocurrency | grep -vE "env|ghcr.io|none") - fi - for a in $tags; do - "$scripts"/custom-timeout.sh 30 docker push "$a" - done - echo "$docker_image_name with tags ${tags//$'\n'/' '} deployed" - fi + docker_login "$DOCKER_USER" "$DOCKER_PASSWORD" + if [[ "$NETWORK" = "LIVE" ]]; then + deploy_tags "${DOCKER_REGISTRY}" "env|ghcr.io|none|latest" else - echo "\$DOCKER_PASSWORD environment variable required" - exit 0 + deploy_tags "${DOCKER_REGISTRY}" "env|ghcr.io|none" fi } + +ghcr_deploy() +{ + docker_login "$DOCKER_USER" "$DOCKER_PASSWORD" "ghcr.io" + deploy_tags "${DOCKER_REGISTRY}/${GITHUB_REPOSITORY}" "env|none" +} + +docker_deploy_env() +{ + docker_login "$DOCKER_USER" "$DOCKER_PASSWORD" + local images=( + "${DOCKER_REGISTRY}/nano-env:base" + "${DOCKER_REGISTRY}/nano-env:gcc" + "${DOCKER_REGISTRY}/nano-env:clang" + ) + deploy_env_images "${images[@]}" +} + +ghcr_deploy_env() +{ + docker_login "$DOCKER_USER" "$DOCKER_PASSWORD" "ghcr.io" + local images=( + "${DOCKER_REGISTRY}/${GITHUB_REPOSITORY}/nano-env:base" + "${DOCKER_REGISTRY}/${GITHUB_REPOSITORY}/nano-env:gcc" + "${DOCKER_REGISTRY}/${GITHUB_REPOSITORY}/nano-env:clang" + "${DOCKER_REGISTRY}/${GITHUB_REPOSITORY}/nano-env:rhel" + ) + deploy_env_images "${images[@]}" +} + +docker_login() +{ + local username=$1 + local password=$2 + local registry=$3 #optional + + if [ -z "$password" ]; then + echo "\$DOCKER_PASSWORD or \$GHCR_TOKEN environment variable required" + exit 1 + fi + + echo "$password" | docker login $registry -u "$username" --password-stdin +} + +push_docker_image() +{ + local image_name=$1 + "$scripts"/custom-timeout.sh 30 docker push "$image_name" +} + +deploy_env_images() +{ + local images=("$@") + + for image in "${images[@]}"; do + push_docker_image "$image" + done + + echo "Deployed nano-env" +} + +deploy_tags() +{ + local repo=$1 + local exclude_pattern=$2 + local tags=$(docker images --format '{{.Repository}}:{{.Tag }}' | grep "$repo" | grep -vE "$exclude_pattern") + + #Debug list all tags + docker images --format '{{.Repository}}:{{.Tag }}' + + for tag in $tags; do + push_docker_image "$tag" + done + + echo "$repo with tags ${tags//$'\n'/' '} deployed" +} diff --git a/ci/actions/linux/ghcr-deploy-env.sh b/ci/actions/linux/ghcr-deploy-env.sh new file mode 100755 index 0000000000..69a53d3187 --- /dev/null +++ b/ci/actions/linux/ghcr-deploy-env.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e +set -x + +source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh" + +ghcr_deploy_env \ No newline at end of file diff --git a/ci/actions/linux/ghcr-deploy.sh b/ci/actions/linux/ghcr-deploy.sh new file mode 100755 index 0000000000..c8247f4d3b --- /dev/null +++ b/ci/actions/linux/ghcr-deploy.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e +set -x + +source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh" + +ghcr_deploy \ No newline at end of file diff --git a/ci/actions/linux/ghcr_push.sh b/ci/actions/linux/ghcr_push.sh deleted file mode 100755 index 89ac8ac8a5..0000000000 --- a/ci/actions/linux/ghcr_push.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -scripts="$PWD/ci" -if [[ "$GITHUB_WORKFLOW" = "Develop Branch Dockers Deploy" ]]; then - "$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:base" - "$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:gcc" - "$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:clang" - "$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:rhel" -else - tags=$(docker images --format '{{.Repository}}:{{.Tag }}' | grep "ghcr.io" | grep -vE "env|none") - for a in $tags; do - "$scripts"/custom-timeout.sh 30 docker push "$a" - done -fi diff --git a/ci/actions/linux/install_deps.sh b/ci/actions/linux/install_deps.sh index 847a5f0719..5f1a42bf63 100755 --- a/ci/actions/linux/install_deps.sh +++ b/ci/actions/linux/install_deps.sh @@ -2,18 +2,20 @@ set -x +DOCKER_REGISTRY="${DOCKER_REGISTRY:-nanocurrency}" + echo "Script ci/actions/linux/install_deps.sh starting COMPILER=\"$COMPILER\"" # This enables IPv6 support in docker, needed to run node tests inside docker container sudo mkdir -p /etc/docker && echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json && sudo service docker restart -ci/build-docker-image.sh docker/ci/Dockerfile-base nanocurrency/nano-env:base +ci/build-docker-image.sh docker/ci/Dockerfile-base ${DOCKER_REGISTRY}/nano-env:base if [[ "${COMPILER:-}" != "" ]]; then - ci/build-docker-image.sh docker/ci/Dockerfile-${COMPILER} nanocurrency/nano-env:${COMPILER} + ci/build-docker-image.sh docker/ci/Dockerfile-${COMPILER} ${DOCKER_REGISTRY}/nano-env:${COMPILER} else - ci/build-docker-image.sh docker/ci/Dockerfile-gcc nanocurrency/nano-env:gcc - ci/build-docker-image.sh docker/ci/Dockerfile-clang nanocurrency/nano-env:clang - ci/build-docker-image.sh docker/ci/Dockerfile-rhel nanocurrency/nano-env:rhel + ci/build-docker-image.sh docker/ci/Dockerfile-gcc ${DOCKER_REGISTRY}/nano-env:gcc + ci/build-docker-image.sh docker/ci/Dockerfile-clang ${DOCKER_REGISTRY}/nano-env:clang + ci/build-docker-image.sh docker/ci/Dockerfile-rhel ${DOCKER_REGISTRY}/nano-env:rhel fi echo "Script ci/actions/linux/install_deps.sh finished" diff --git a/ci/actions/windows/build.ps1 b/ci/actions/windows/build.ps1 index af867129c5..45d05bea92 100644 --- a/ci/actions/windows/build.ps1 +++ b/ci/actions/windows/build.ps1 @@ -2,24 +2,23 @@ $ErrorActionPreference = "Continue" if (${env:artifact} -eq 1) { $env:BUILD_TYPE = "Release" - if ( ${env:BETA} -eq 1 ) { + if ( ${env:NETWORK} -eq "BETA" ) { $env:NETWORK_CFG = "beta" $env:BUILD_TYPE = "RelWithDebInfo" } - elseif (${env:TEST} -eq 1) { + elseif (${env:NETWORK} -eq "TEST") { $env:NETWORK_CFG = "test" } else { $env:NETWORK_CFG = "live" } $env:NANO_TEST = "-DNANO_TEST=OFF" - $env:CI_TAG = ${env:TAG} if ([string]::IsNullOrEmpty(${env:VERSION_PRE_RELEASE})) { $env:CI_VERSION_PRE_RELEASE = "OFF" } else { $env:CI_VERSION_PRE_RELEASE = ${env:VERSION_PRE_RELEASE} } - $env:CI = "-DCI_BUILD=ON -DCI_VERSION_PRE_RELEASE=${env:CI_VERSION_PRE_RELEASE}" + $env:CI = "-DCI_TAG=${env:TAG} -DCI_VERSION_PRE_RELEASE=${env:CI_VERSION_PRE_RELEASE}" $env:RUN = "artifact" } else { diff --git a/ci/actions/windows/deploy.ps1 b/ci/actions/windows/deploy.ps1 index 167756ec27..4a859ecebf 100644 --- a/ci/actions/windows/deploy.ps1 +++ b/ci/actions/windows/deploy.ps1 @@ -1,20 +1,21 @@ $ErrorActionPreference = "Continue" -if ( ${env:BETA} -eq 1 ) { +$env:S3_BUCKET_NAME = $env:S3_BUCKET_NAME ?? "repo.nano.org" +if ( "${env:NETWORK}" -eq "BETA" ) { $network_cfg = "beta" } -elseif ( ${env:TEST} -eq 1 ) { +elseif ( "${env:NETWORK}" -eq "TEST" ) { $network_cfg = "test" } else { $network_cfg = "live" } -if ( ${env:GITHUB_REPOSITORY} -eq "nanocurrency/nano-node" ) { - $directory=$network_cfg +if (![string]::IsNullOrEmpty($env:S3_BUILD_DIRECTORY)) { + $directory = "$env:S3_BUILD_DIRECTORY/$network_cfg" } else { - $directory=${env:S3_BUILD_DIRECTORY}+"/"+$network_cfg + $directory = $network_cfg } $exe = Resolve-Path -Path $env:GITHUB_WORKSPACE\build\nano-node-*-win64.exe @@ -29,7 +30,7 @@ $zip_hash | Out-file -FilePath "$zip.sha256" Write-Output "Hash: $exe_hash" Write-Output "Hash: $zip_hash" -aws s3 cp "$exe" s3://repo.nano.org/$directory/binaries/nano-node-$env:TAG-win64.exe --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers -aws s3 cp "$exe.sha256" s3://repo.nano.org/$directory/binaries/nano-node-$env:TAG-win64.exe.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers -aws s3 cp "$zip" s3://repo.nano.org/$directory/binaries/nano-node-$env:TAG-win64.zip --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers -aws s3 cp "$zip.sha256" s3://repo.nano.org/$directory/binaries/nano-node-$env:TAG-win64.zip.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers \ No newline at end of file +aws s3 cp "$exe" s3://$env:S3_BUCKET_NAME/$directory/binaries/nano-node-$env:TAG-win64.exe --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers +aws s3 cp "$exe.sha256" s3://$env:S3_BUCKET_NAME/$directory/binaries/nano-node-$env:TAG-win64.exe.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers +aws s3 cp "$zip" s3://$env:S3_BUCKET_NAME/$directory/binaries/nano-node-$env:TAG-win64.zip --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers +aws s3 cp "$zip.sha256" s3://$env:S3_BUCKET_NAME/$directory/binaries/nano-node-$env:TAG-win64.zip.sha256 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers diff --git a/ci/build-deploy.sh b/ci/build-deploy.sh index 25f716e906..c520a3a718 100755 --- a/ci/build-deploy.sh +++ b/ci/build-deploy.sh @@ -15,10 +15,10 @@ mkdir build pushd build CONFIGURATION="Release" -if [[ "${BETA:-0}" -eq 1 ]]; then +if [[ "${NETWORK}" == "BETA" ]]; then NETWORK_CFG="beta" CONFIGURATION="RelWithDebInfo" -elif [[ "${TEST:-0}" -eq 1 ]]; then +elif [[ "${NETWORK}" == "TEST" ]]; then NETWORK_CFG="test" else NETWORK_CFG="live" diff --git a/ci/build-gitlab.sh b/ci/build-gitlab.sh index 83a62e15da..7eb8894e6a 100755 --- a/ci/build-gitlab.sh +++ b/ci/build-gitlab.sh @@ -52,7 +52,10 @@ if [[ ${FLAVOR-_} == "_" ]]; then FLAVOR="" fi -if [[ "${BETA}" -eq 1 ]]; then +if [[ "${NETWORK}" == "TEST" ]]; then + NETWORK_CFG="-DACTIVE_NETWORK=nano_test_network" + CONFIGURATION="RelWithDebInfo" +elif [[ "${NETWORK}" == "BETA" ]]; then NETWORK_CFG="-DACTIVE_NETWORK=nano_beta_network" CONFIGURATION="RelWithDebInfo" else diff --git a/ci/build-rhel.sh b/ci/build-rhel.sh index 6726567504..96c358ef09 100755 --- a/ci/build-rhel.sh +++ b/ci/build-rhel.sh @@ -11,9 +11,9 @@ run_source() { run_build() { mkdir -p ~/rpmbuild/SOURCES/ mv -f ~/nano-${VERSION}.tar.gz ~/rpmbuild/SOURCES/. - if [ "${LIVE:-}" == "1" ]; then + if [[ "${NETWORK}" == "LIVE" ]]; then scl enable gcc-toolset-12 'rpmbuild --nodebuginfo -ba nanocurrency.spec' - elif [ "${BETA:-}" == "1" ]; then + elif [[ "${NETWORK}" == "BETA" ]]; then scl enable gcc-toolset-12 'rpmbuild -ba nanocurrency-beta.spec' else echo "Error: the node network was not defined." diff --git a/ci/build.sh b/ci/build.sh index a238241022..62192e7e7d 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -54,6 +54,8 @@ cmake \ -DNANO_TEST=${NANO_TEST:-OFF} \ -DNANO_GUI=${NANO_GUI:-OFF} \ -DCOVERAGE=${COVERAGE:-OFF} \ +-DCI_TAG=${CI_TAG:-OFF} \ +-DCI_VERSION_PRE_RELEASE=${CI_VERSION_PRE_RELEASE:-OFF} \ ${CMAKE_SANITIZER:-} \ ${CMAKE_QT_DIR:-} \ ${CMAKE_BACKTRACE:-} \ diff --git a/ci/prepare/macos/prepare.sh b/ci/prepare/macos/prepare.sh index 5ca21a9b82..b66fedaac7 100755 --- a/ci/prepare/macos/prepare.sh +++ b/ci/prepare/macos/prepare.sh @@ -1,7 +1,9 @@ #!/bin/bash set -euox pipefail -brew update +#Homebrew randomly fails to update. Retry 5 times with 15s interval +for i in {1..5}; do brew update && break || { echo "Update failed, retrying..."; sleep 15; }; done + brew install coreutils brew install qt@5 diff --git a/docker/node/Dockerfile b/docker/node/Dockerfile index 53bd060df3..0c36f545c8 100644 --- a/docker/node/Dockerfile +++ b/docker/node/Dockerfile @@ -1,12 +1,7 @@ FROM ubuntu:22.04 as builder ARG COMPILER=gcc -ARG BUILD_TYPE=RelWithDebInfo -ARG SANITIZER ARG NANO_NETWORK=live -ARG CI_TAG=DEV_BUILD -ARG CI_BUILD=OFF -ARG CI_VERSION_PRE_RELEASE=OFF # Install build dependencies COPY ./ci/prepare/linux /tmp/prepare @@ -15,6 +10,15 @@ RUN /tmp/prepare/prepare.sh COPY ./ /tmp/src WORKDIR /tmp/src +#Define ARGs for ci/build-node.sh +ARG BUILD_TYPE=RelWithDebInfo +ARG NANO_TEST=OFF +ARG COVERAGE=OFF +ARG CMAKE_SANITIZER="" +ARG CI_TAG=DEV_BUILD +ARG CI_VERSION_PRE_RELEASE=OFF +ARG SANITIZER + # Build node RUN ci/build-node.sh RUN echo ${NANO_NETWORK} >/etc/nano-network