From 74a47f15e8de2f7f0ba570b5fbf4a13aaef85dfe Mon Sep 17 00:00:00 2001 From: Patrick Maslana Date: Thu, 7 Nov 2024 13:54:49 -0700 Subject: [PATCH 1/3] Test how long it takes for a runner to generate a k25 plot in CI --- .../workflows/build-linux-installer-deb.yml | 5 + .../workflows/build-linux-installer-rpm.yml | 4 + .github/workflows/build-macos-installers.yml | 4 + .github/workflows/build-windows-installer.yml | 249 ++++++++++++------ 4 files changed, 176 insertions(+), 86 deletions(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index 5575fd3f4f52..033c53dabaf3 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -333,6 +333,11 @@ jobs: if: matrix.mode.name == 'GUI' run: | [ $(stat -c %a:%G:%U /opt/chia/chrome-sandbox) == "4755:root:root" ] + + - name: Test generation of a k25 plot + run: | + chia plots create -k 25 -t ./tmp -d ./plot --override-k + chia plots check -n 1 - name: Remove package run: | diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index 586f75fc0431..e743c0e40a23 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -331,6 +331,10 @@ jobs: ls -l /opt false fi + + - name: Test generation of a k25 plot + run: | + chia plots create -k 25 -t ./tmp -d ./plot --override-k - name: Remove package run: | diff --git a/.github/workflows/build-macos-installers.yml b/.github/workflows/build-macos-installers.yml index 13227c61b736..899daf4a8d9a 100644 --- a/.github/workflows/build-macos-installers.yml +++ b/.github/workflows/build-macos-installers.yml @@ -355,6 +355,10 @@ jobs: run: | "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.version.outputs.chia-installer-version }}" + - name: Test generation of a k25 plot + run: | + /Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" plots create -k 25 -t ./tmp -d ./plot --override-k + - name: Detach .dmg if: always() run: | diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index 78c73ddb9e74..c63e0b0b1c42 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -29,7 +29,8 @@ on: - "**" concurrency: - group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} cancel-in-progress: true permissions: @@ -37,14 +38,9 @@ permissions: contents: write jobs: - version: - uses: ./.github/workflows/reflow-version.yml - build: name: Build EXE runs-on: [windows-2019] - needs: - - version timeout-minutes: 65 outputs: chia-installer-version: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} @@ -53,11 +49,6 @@ jobs: matrix: python-version: ["3.10"] - env: - CHIA_INSTALLER_VERSION: ${{ needs.version.outputs.chia-installer-version }} - SETUPTOOLS_SCM_PRETEND_VERSION_FOR_CHIA_BLOCKCHAIN: ${{ needs.version.outputs.chia-installer-version }} - TAG_TYPE: ${{ needs.version.outputs.tag-type }} - steps: - name: Checkout Code uses: actions/checkout@v4 @@ -70,7 +61,22 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: Chia-Network/actions/git-ssh-to-https@main + - name: Check tag type + shell: bash + run: | + REG_B="^[0-9]+\.[0-9]+\.[0-9]+-b[0-9]+$" + REG_RC="^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$" + if [[ "${{ github.event.release.tag_name }}" =~ $REG_B ]] || [[ "${{ inputs.release_type }}" =~ $REG_B ]]; then + echo "TAG_TYPE=beta" + echo "TAG_TYPE=beta" >> "$GITHUB_ENV" + elif [[ "${{ github.event.release.tag_name }}" =~ $REG_RC ]] || [[ "${{ inputs.release_type }}" =~ $REG_RC ]]; then + echo "TAG_TYPE=rc" + echo "TAG_TYPE=rc" >> "$GITHUB_ENV" + fi + + - name: Set git urls to https instead of ssh + run: | + git config --global url."https://github.com/".insteadOf ssh://git@github.com/ - name: Get npm cache directory id: npm-cache @@ -87,8 +93,6 @@ jobs: ${{ runner.os }}-node- - uses: chia-network/actions/cache-pip@main - with: - mode: poetry - uses: Chia-Network/actions/setup-python@main name: Install Python ${{ matrix.python-version }} @@ -141,6 +145,19 @@ jobs: C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user smksp_cert_sync.exe + # Create our own venv outside of the git directory JUST for getting the ACTUAL version so that install can't break it + - name: Get version number + id: version_number + shell: bash + run: | + python -m venv ../venv + source ../venv/Scripts/activate + pip3 install setuptools_scm + CHIA_INSTALLER_VERSION=$(python ./build_scripts/installer-version.py) + echo "$CHIA_INSTALLER_VERSION" + echo "CHIA_INSTALLER_VERSION=$CHIA_INSTALLER_VERSION" >> "$GITHUB_OUTPUT" + deactivate + - name: Get latest madmax plotter env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -220,6 +237,7 @@ jobs: - name: Build Windows installer env: + CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} HAS_SIGNING_SECRET: ${{ steps.check_secrets.outputs.HAS_SIGNING_SECRET }} run: | $env:path="C:\Program` Files` (x86)\Microsoft` Visual` Studio\2019\Enterprise\SDK\ScopeCppSDK\vc15\VC\bin\;$env:path" @@ -231,7 +249,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: chia-installers-windows-exe-intel - path: chia-blockchain-gui\release-builds\windows-installer\ + path: ${{ github.workspace }}\chia-blockchain-gui\release-builds\ - name: Remove Windows exe and installer to exclude from cache run: | @@ -241,70 +259,139 @@ jobs: Remove-Item .\chia-blockchain-gui\release-builds -Recurse -Force publish: - name: 📦 Publish Installers - uses: ./.github/workflows/reflow-publish-installer.yml - with: - concurrency-name: windows - chia-installer-version: ${{ needs.version.outputs.chia-installer-version }} - chia-dev-version: ${{ needs.version.outputs.chia-dev-version }} - configuration: ${{ toJSON( matrix.configuration ) }} - secrets: inherit + name: Publish EXE + runs-on: ubuntu-latest needs: - - version - build + timeout-minutes: 5 strategy: fail-fast: false matrix: - configuration: - - python-version: ["3.10"] - os: - - matrix: windows - file-type: - name: EXE - extension: exe - glue-name: windows - artifact-platform-name: windows - file-arch-name: - intel: intel - file-suffix: - arm: "" - intel: "" - names: - gui: - file: ChiaSetup-{0}.exe - dev-file: ChiaSetup-{1}.exe - latest-dev-file: ChiaSetup-latest-dev.exe - mode: - - name: GUI - matrix: gui - glue-name: gui - - name: CLI - matrix: cli - glue-name: cli - arch: - - name: ARM64 - matrix: arm - artifact-name: arm - glue-name: arm - - name: Intel - matrix: intel - artifact-name: intel - glue-name: intel - exclude: - - os: - matrix: windows - arch: - matrix: arm - - os: - matrix: windows - mode: - matrix: cli + python-version: ["3.10"] + + env: + CHIA_INSTALLER_VERSION: ${{ needs.build.outputs.chia-installer-version }} + + steps: + - uses: Chia-Network/actions/clean-workspace@main + + - uses: Chia-Network/actions/setup-python@main + with: + python-version: ${{ matrix.python-version }} + + - uses: chia-network/actions/create-venv@main + id: create-venv + + - uses: chia-network/actions/activate-venv@main + with: + directories: ${{ steps.create-venv.outputs.activate-venv-directories }} + + - name: Download constraints file + uses: actions/download-artifact@v4 + with: + name: constraints-file-intel + path: venv + + - name: Install utilities + run: | + pip install --constraint venv/constraints.txt py3createtorrent + + - name: Download packages + uses: actions/download-artifact@v4 + with: + name: chia-installers-windows-exe-intel + path: chia-blockchain-gui/release-builds/ + + - name: Set Env + uses: Chia-Network/actions/setjobenv@main + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Test for secrets access + id: check_secrets + run: | + unset HAS_AWS_SECRET + unset HAS_GLUE_SECRET + + if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi + echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >> "$GITHUB_OUTPUT" + + if [ -n "$GLUE_API_URL" ]; then HAS_GLUE_SECRET='true' ; fi + echo HAS_GLUE_SECRET=${HAS_GLUE_SECRET} >> "$GITHUB_OUTPUT" + env: + SIGNING_SECRET: "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" + AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}" + GLUE_API_URL: "${{ secrets.GLUE_API_URL }}" + + - name: Configure AWS credentials + if: steps.check_secrets.outputs.HAS_AWS_SECRET + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ secrets.CHIA_AWS_ACCOUNT_ID }}:role/installer-upload + aws-region: us-west-2 + + - name: Upload to s3 + if: steps.check_secrets.outputs.HAS_AWS_SECRET + run: | + GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8) + CHIA_DEV_BUILD=${CHIA_INSTALLER_VERSION}-$GIT_SHORT_HASH + echo CHIA_DEV_BUILD=${CHIA_DEV_BUILD} >> "$GITHUB_OUTPUT" + echo ${CHIA_DEV_BUILD} + pwd + aws s3 cp chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${CHIA_INSTALLER_VERSION}.exe s3://download.chia.net/dev/ChiaSetup-${CHIA_DEV_BUILD}.exe + + - name: Create Checksums + run: | + ls "$GITHUB_WORKSPACE"/chia-blockchain-gui/release-builds/windows-installer/ + sha256sum "$GITHUB_WORKSPACE"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe > "$GITHUB_WORKSPACE"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe.sha256 + ls "$GITHUB_WORKSPACE"/chia-blockchain-gui/release-builds/windows-installer/ + + - name: Create torrent + if: env.FULL_RELEASE == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe -o "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe.torrent --webseed https://download.chia.net/install/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe + ls + gh release upload --repo ${{ github.repository }} $RELEASE_TAG "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe.torrent + + - name: Upload Dev Installer + if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' + run: | + aws s3 cp "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe s3://download.chia.net/latest-dev/ChiaSetup-latest-dev.exe + aws s3 cp "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe.sha256 s3://download.chia.net/latest-dev/ChiaSetup-latest-dev.exe.sha256 + + - name: Upload Release Files + if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' + run: | + aws s3 cp "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe s3://download.chia.net/install/ + aws s3 cp "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe.sha256 s3://download.chia.net/install/ + aws s3 cp "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe.torrent s3://download.chia.net/torrents/ + + - name: Upload release artifacts + if: env.RELEASE == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload --repo ${{ github.repository }} $RELEASE_TAG "${GITHUB_WORKSPACE}"/chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${{ env.CHIA_INSTALLER_VERSION }}.exe + + - uses: Chia-Network/actions/github/jwt@main + if: steps.check_secrets.outputs.HAS_GLUE_SECRET + + - name: Mark pre-release installer complete + if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.PRE_RELEASE == 'true' + run: | + curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"chia_ref": "${{ env.RELEASE_TAG }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ env.RFC_REPO }}-prerelease/${{ env.RELEASE_TAG }}/success/build-windows + + - name: Mark release installer complete + if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.FULL_RELEASE == 'true' + run: | + curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"chia_ref": "${{ env.RELEASE_TAG }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ env.RFC_REPO }}/${{ env.RELEASE_TAG }}/success/build-windows test: name: Test ${{ matrix.os.name }} runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} needs: - - version - build strategy: fail-fast: false @@ -322,9 +409,6 @@ jobs: - name: Intel matrix: intel - env: - INSTALL_PATH: installed/ - steps: - uses: Chia-Network/actions/clean-workspace@main @@ -335,26 +419,19 @@ jobs: path: packages - name: Install package + env: + INSTALL_PATH: ${{ github.workspace }}\installed run: | dir ./packages/ - $env:INSTALLER_PATH = (Get-ChildItem packages/ChiaSetup-*.exe) - # note that the installer requires the target path use backslashes - $env:RESOLVED_INSTALL_PATH = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($env:INSTALL_PATH) - Start-Process -Wait -FilePath $env:INSTALLER_PATH -ArgumentList "/S", ("/D=" + $env:RESOLVED_INSTALL_PATH) - echo ====================================== - dir ./ - echo ====================================== - dir ./installed/ + $env:INSTALLER_PATH = (Get-ChildItem packages/windows-installer/ChiaSetup-*.exe) + Start-Process -Wait -FilePath $env:INSTALLER_PATH -ArgumentList "/S", ("/D=" + $env:INSTALL_PATH) - name: List installed files run: | Get-ChildItem -Recurse $env:INSTALL_PATH | Select FullName - - name: List all files - if: - run: | - Get-ChildItem -Recurse $env:INSTALL_PATH | Select FullName - - name: Run chia dev installers test + env: + INSTALL_PATH: ${{ github.workspace }}\installed run: | - & ($env:INSTALL_PATH + "/resources/app.asar.unpacked/daemon/chia.exe") dev installers test --expected-chia-version "${{ needs.version.outputs.chia-installer-version }}" + & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" From 0c096857191db3514b007ef29aeb584f4af0b60e Mon Sep 17 00:00:00 2001 From: Patrick Maslana Date: Tue, 2 Apr 2024 12:25:58 -0700 Subject: [PATCH 2/3] Add a command to check the plots --- .github/workflows/build-linux-installer-deb.yml | 2 +- .github/workflows/build-linux-installer-rpm.yml | 1 + .github/workflows/build-macos-installers.yml | 1 + .github/workflows/build-windows-installer.yml | 7 +++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index 033c53dabaf3..2b234a877b60 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -338,7 +338,7 @@ jobs: run: | chia plots create -k 25 -t ./tmp -d ./plot --override-k chia plots check -n 1 - + - name: Remove package run: | apt-get remove --yes ${{ matrix.mode.package }} diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index e743c0e40a23..4b94697f7a32 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -335,6 +335,7 @@ jobs: - name: Test generation of a k25 plot run: | chia plots create -k 25 -t ./tmp -d ./plot --override-k + chia plots check -n 1 - name: Remove package run: | diff --git a/.github/workflows/build-macos-installers.yml b/.github/workflows/build-macos-installers.yml index 899daf4a8d9a..1e91495d8444 100644 --- a/.github/workflows/build-macos-installers.yml +++ b/.github/workflows/build-macos-installers.yml @@ -358,6 +358,7 @@ jobs: - name: Test generation of a k25 plot run: | /Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" plots create -k 25 -t ./tmp -d ./plot --override-k + /Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" chia plots check -n 1 - name: Detach .dmg if: always() diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index c63e0b0b1c42..a31958c14553 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -435,3 +435,10 @@ jobs: INSTALL_PATH: ${{ github.workspace }}\installed run: | & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + + - name: Test generation of a k25 plot + env: + INSTALL_PATH: ${{ github.workspace }}\installed + run: | + & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") plots create -k 25 -t ./tmp -d ./plot --override-k + & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") chia plots check -n 1 From a7101bb4fe495e6aaa7f48e0a551d8ffb82ef98a Mon Sep 17 00:00:00 2001 From: Patrick Maslana Date: Wed, 29 May 2024 18:06:04 -0700 Subject: [PATCH 3/3] Add a comment to see if CI passes --- .github/workflows/build-windows-installer.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index a31958c14553..f68bfbc8229d 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -435,7 +435,8 @@ jobs: INSTALL_PATH: ${{ github.workspace }}\installed run: | & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" - + + # Testing to see how long the plot takes - name: Test generation of a k25 plot env: INSTALL_PATH: ${{ github.workspace }}\installed