[CHIA-777] Generalize p2_singleton_via_delegated_puzzle
#27926
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 📦🚀 Build Installer - Linux RPM AMD64 | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
description: "Tagged release testing scenario" | |
required: false | |
type: choice | |
default: "" | |
options: | |
- "" | |
- 9.9.9-b1 | |
- 9.9.9-rc1 | |
- 9.9.9 | |
push: | |
paths-ignore: | |
- "**.md" | |
branches: | |
- "long_lived/**" | |
- main | |
- "release/**" | |
release: | |
types: [published] | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
branches: | |
- "**" | |
concurrency: | |
# 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: | |
id-token: write | |
contents: write | |
jobs: | |
build: | |
name: Build amd64 RPM | |
runs-on: ubuntu-latest | |
container: | |
image: chianetwork/rocky8-builder:latest | |
timeout-minutes: 40 | |
outputs: | |
chia-installer-version: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Add safe git directory | |
uses: Chia-Network/actions/git-mark-workspace-safe@main | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: Chia-Network/actions/git-ssh-to-https@main | |
- name: Cleanup any leftovers that exist from previous runs | |
run: bash build_scripts/clean-runner.sh || true | |
- name: Set Env | |
uses: Chia-Network/actions/setjobenv@main | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- 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 | |
- uses: Chia-Network/actions/enforce-semver@main | |
if: env.FULL_RELEASE == 'true' | |
# 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 | |
run: | | |
python3 -m venv ../venv | |
. ../venv/bin/activate | |
pip3 install setuptools_scm | |
echo "CHIA_INSTALLER_VERSION=$(python3 ./build_scripts/installer-version.py)" >> "$GITHUB_OUTPUT" | |
deactivate | |
- name: Get latest madmax plotter | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
LATEST_MADMAX=$(gh api repos/Chia-Network/chia-plotter-madmax/releases/latest --jq 'select(.prerelease == false) | .tag_name') | |
mkdir "$GITHUB_WORKSPACE"/madmax | |
gh release download -R Chia-Network/chia-plotter-madmax "$LATEST_MADMAX" -p 'chia_plot-*-x86-64' -O "$GITHUB_WORKSPACE"/madmax/chia_plot | |
gh release download -R Chia-Network/chia-plotter-madmax "$LATEST_MADMAX" -p 'chia_plot_k34-*-x86-64' -O "$GITHUB_WORKSPACE"/madmax/chia_plot_k34 | |
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot | |
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot_k34 | |
- name: Fetch bladebit versions | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Fetch the latest version of each type | |
LATEST_RELEASE=$(gh api repos/Chia-Network/bladebit/releases/latest --jq 'select(.prerelease == false) | .tag_name') | |
LATEST_BETA=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+$"))) | first | .tag_name') | |
LATEST_RC=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+$"))) | first | .tag_name') | |
# Compare the versions and choose the newest that matches the requirements | |
if [[ "$TAG_TYPE" == "beta" || -z "$TAG_TYPE" ]]; then | |
# For beta or dev builds (indicated by the absence of a tag), use the latest version available | |
LATEST_VERSION=$(printf "%s\n%s\n%s\n" "$LATEST_RELEASE" "$LATEST_BETA" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1) | |
elif [[ "$TAG_TYPE" == "rc" ]]; then | |
# For RC builds, use the latest RC or full release if it's newer | |
LATEST_VERSION=$(printf "%s\n%s\n" "$LATEST_RELEASE" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1) | |
else | |
# For full releases, use the latest full release | |
LATEST_VERSION="$LATEST_RELEASE" | |
fi | |
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV" | |
- name: Get latest bladebit plotter | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Download and extract the chosen version | |
mkdir "$GITHUB_WORKSPACE"/bladebit | |
cd "$GITHUB_WORKSPACE"/bladebit | |
gh release download -R Chia-Network/bladebit "$LATEST_VERSION" -p 'bladebit*-centos-x86-64.tar.gz' | |
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}' | |
ls bladebit* | xargs -I{} chmod +x {} | |
cd "$OLDPWD" | |
- uses: ./.github/actions/install | |
with: | |
python-version: ${{ matrix.python-version }} | |
development: true | |
constraints-file-artifact-name: constraints-file-intel | |
- uses: chia-network/actions/activate-venv@main | |
- name: Prepare GUI cache | |
id: gui-ref | |
run: | | |
gui_ref=$(git submodule status chia-blockchain-gui | sed -e 's/^ //g' -e 's/ chia-blockchain-gui.*$//g') | |
echo "${gui_ref}" | |
echo "GUI_REF=${gui_ref}" >> "$GITHUB_OUTPUT" | |
echo "rm -rf ./chia-blockchain-gui" | |
rm -rf ./chia-blockchain-gui | |
- name: Cache GUI | |
uses: actions/cache@v4 | |
id: cache-gui | |
with: | |
path: ./chia-blockchain-gui | |
key: ${{ runner.os }}-rpm-chia-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} | |
- if: steps.cache-gui.outputs.cache-hit != 'true' | |
name: Build GUI | |
continue-on-error: false | |
run: | | |
cd ./build_scripts | |
bash build_linux_rpm-1-gui.sh | |
- name: Build .rpm package | |
env: | |
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} | |
run: | | |
ldd --version | |
cd ./build_scripts | |
bash build_linux_rpm-2-installer.sh amd64 | |
- name: Upload fpm-generated rpm spec files | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: spec | |
path: | | |
build_scripts/dist/cli.spec | |
build_scripts/dist/gui.spec | |
- name: Upload Linux artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chia-installers-linux-rpm-intel | |
path: ${{ github.workspace }}/build_scripts/final_installer/ | |
- name: Remove working files to exclude from cache | |
run: | | |
rm -rf ./chia-blockchain-gui/packages/gui/daemon | |
publish: | |
name: Publish amd64 RPM | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
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-linux-rpm-intel | |
path: build_scripts/final_installer/ | |
- name: Set Env | |
uses: Chia-Network/actions/setjobenv@main | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test for secrets access | |
id: check_secrets | |
shell: bash | |
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: | |
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_ENV" | |
ls "$GITHUB_WORKSPACE"/build_scripts/final_installer/ | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/dev/chia-blockchain-${CHIA_DEV_BUILD}-1.x86_64.rpm | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/dev/chia-blockchain-cli-${CHIA_DEV_BUILD}-1.x86_64.rpm | |
- name: Create Checksums | |
run: | | |
ls "$GITHUB_WORKSPACE"/build_scripts/final_installer/ | |
sha256sum "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm > "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 | |
sha256sum "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm > "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 | |
ls "$GITHUB_WORKSPACE"/build_scripts/final_installer/ | |
- name: Create .rpm torrent | |
if: env.FULL_RELEASE == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm -o "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent --webseed https://download.chia.net/install/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm | |
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm -o "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent --webseed https://download.chia.net/install/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm | |
gh release upload --repo ${{ github.repository }} $RELEASE_TAG "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent | |
- name: Upload Dev Installer | |
if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' | |
run: | | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/latest-dev/chia-blockchain-1.x86_64_latest_dev.rpm | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/latest-dev/chia-blockchain-1.x86_64_latest_dev.rpm.sha256 | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/latest-dev/chia-blockchain-cli-1.x86_64_latest_dev.rpm | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/latest-dev/chia-blockchain-cli-1.x86_64_latest_dev.rpm.sha256 | |
- name: Upload Release Files | |
if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' | |
run: | | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/install/ | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/install/ | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent s3://download.chia.net/torrents/ | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/install/ | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/install/ | |
aws s3 cp "$GITHUB_WORKSPACE"/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.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 \ | |
build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm \ | |
build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm | |
- 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-linux-rpm | |
- 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-linux-rpm | |
test: | |
name: Test ${{ matrix.distribution.name }} ${{ matrix.mode.name }} ${{ matrix.state.name }} | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build | |
container: ${{ matrix.distribution.url }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
distribution: | |
- name: amazonlinux:2023 | |
type: amazon | |
url: "docker://amazonlinux:2023" | |
- name: fedora:37 | |
type: fedora | |
# (37, 3.11) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+37&start=0 | |
url: "docker://fedora:37" | |
- name: fedora:38 | |
type: fedora | |
# (38, 3.11) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+38&start=0 | |
url: "docker://fedora:38" | |
- name: rockylinux:8 | |
type: rocky | |
url: "docker://rockylinux:8" | |
- name: rockylinux:9 | |
type: rocky | |
url: "docker://rockylinux:9" | |
# bypass this error for now: Problem: The operation would result in removing the following protected packages: systemd-udev | |
noautoremove: | |
gui: --noautoremove | |
- name: build image | |
type: rocky | |
url: "docker://chianetwork/rocky8-builder:latest" | |
mode: | |
- name: GUI | |
matrix: gui | |
file: chia-blockchain-[0,1,2,3,4,5,6,7,8,9]*.rpm | |
package: chia-blockchain | |
- name: CLI | |
matrix: cli | |
file: chia-blockchain-cli-[0,1,2,3,4,5,6,7,8,9]*.rpm | |
package: chia-blockchain-cli | |
state: | |
- name: Dirty | |
matrix: dirty | |
- name: Clean | |
matrix: clean | |
steps: | |
- uses: Chia-Network/actions/clean-workspace@main | |
- name: Download packages | |
uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: chia-installers-linux-rpm-intel | |
path: packages | |
- name: Dirty the environment for the sake of testing | |
if: matrix.state.matrix == 'dirty' | |
run: | | |
# this has been known to mess up the version detection, the empty directory should be removed | |
mkdir --parents /opt/chia/chia_blockchain-0.1.dist-info | |
# making sure that files are not removed | |
touch /opt/chia/touched | |
- name: Install package | |
run: | | |
ls -l "${{ steps.download.outputs.download-path }}" | |
yum install -y numactl-libs "${{ steps.download.outputs.download-path }}"/${{ matrix.mode.file }} | |
- name: List /opt/chia contents | |
run: | | |
find /opt/chia | |
- name: Run chia dev installers test | |
run: | | |
chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" | |
- name: Verify /opt/chia present | |
run: | | |
if [ ! -e /opt/chia ] | |
then | |
ls -l /opt | |
false | |
fi | |
- name: Remove package | |
run: | | |
yum remove -y ${{ matrix.distribution.noautoremove[matrix.mode.matrix] }} ${{ matrix.mode.package }} | |
- name: Verify /opt/chia not present | |
if: matrix.state.matrix == 'clean' | |
run: | | |
if [ -e /opt/chia ] | |
then | |
ls -lR /opt/chia | |
false | |
fi | |
- name: Verify /opt/chia contains only touched file | |
if: matrix.state.matrix == 'dirty' | |
run: | | |
ACTUAL=$(ls -a /opt/chia) | |
EXPECTED=$(echo -e '.\n..\ntouched') | |
echo " actual: ${ACTUAL}" | |
echo "expected: ${EXPECTED}" | |
if [ "${ACTUAL}" != "${EXPECTED}" ] | |
then | |
echo " !!! they do not match" | |
ls -lR /opt/chia | |
false | |
else | |
echo " :] they match" | |
fi |