From 74ab772ecce0bdcf26f8645bbc7b7edcda2f3600 Mon Sep 17 00:00:00 2001 From: Earle Lowe Date: Tue, 23 Jan 2024 08:29:47 -0800 Subject: [PATCH 1/3] Add python versions and upload to chia pypi --- .github/workflows/build-test-riscv64.yml | 147 +++++++++++++++++------ 1 file changed, 108 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 58e424218..ad7c7e4c5 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -6,52 +6,121 @@ on: - main - dev tags: - - '**' + - "**" pull_request: branches: - - '**' + - "**" jobs: - build: + build_wheels: timeout-minutes: 60 - name: QEMU riscv64 via Debian on ubuntu-latest + name: ${{ matrix.os.emoji }} 📦 Build ${{ matrix.python.major-dot-minor }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ ubuntu-latest ] + os: [ubuntu-latest] + python: + - major-dot-minor: "3.8" + matrix: "3.8" + - major-dot-minor: "3.9" + matrix: "3.9" + - major-dot-minor: "3.10" + matrix: "3.10" + - major-dot-minor: "3.11" + matrix: "3.11" steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Set up QEMU on x86_64 - if: startsWith(matrix.os, 'ubuntu-latest') - id: qemu - uses: docker/setup-qemu-action@v2 - with: - platforms: riscv64 -# image: tonistiigi/binfmt:latest - - - name: Build and Test - run: | - docker run --rm --platform linux/riscv64 \ - -v ${{ github.workspace }}:/ws --workdir=/ws \ - chianetwork/ubuntu-22.04-risc-builder:latest \ - bash -exc '\ - cmake --version && \ - uname -a && \ - export CP_USE_GREEN_REAPER=0 && \ - pip wheel -w dist . && \ - python3 -m venv venv && \ - ./venv/bin/python -m pip install dist/*.whl && \ - ./venv/bin/python -m pip install pytest && \ - ./venv/bin/python -m pytest -k "not k_21" -v tests/ - ' - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: packages - path: ./dist + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Set up QEMU on x86_64 + if: startsWith(matrix.os, 'ubuntu-latest') + id: qemu + uses: docker/setup-qemu-action@v2 + with: + platforms: riscv64 + # image: tonistiigi/binfmt:latest + + - name: Build and Test + run: | + docker run --rm --platform linux/riscv64 \ + -v ${{ github.workspace }}:/ws --workdir=/ws \ + chianetwork/ubuntu-22.04-risc-builder:latest \ + bash -exc '\ + pyenv global ${{ matrix.python.matrix }} && \ + cmake --version && \ + uname -a && \ + export CP_USE_GREEN_REAPER=0 && \ + pip wheel -w dist . && \ + python3 -m venv venv && \ + ./venv/bin/python -m pip install dist/*.whl && \ + ./venv/bin/python -m pip install pytest && \ + ./venv/bin/python -m pytest -k "not k_21" -v tests/ + ' + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: packages + path: ./dist + if-no-files-found: error + upload: + name: Upload to Chia PyPI + runs-on: ubuntu-latest + needs: + - build_wheels + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set Env + uses: Chia-Network/actions/setjobenv@main + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Download artifacts + if: env.RELEASE == 'true' + uses: actions/download-artifact@v3 + with: + name: packages + path: ./dist + + - name: Configure AWS credentials + if: env.RELEASE == 'true' + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::${{ secrets.CHIA_AWS_ACCOUNT_ID }}:role/installer-upload + aws-region: us-west-2 + + - name: List existing wheels + if: env.RELEASE == 'true' + shell: sh + run: | + aws s3 ls s3://download.chia.net/simple/chiavdf/ > existing_wheel_list_raw + cat existing_wheel_list_raw + cat existing_wheel_list_raw | tr -s ' ' | cut -d ' ' -f 4 > existing_wheel_list + + - name: List new wheels + if: env.RELEASE == 'true' + shell: sh + run: | + (cd dist/; ls ${{ inputs.package_name }}-*.whl) > new_wheel_list + cat new_wheel_list | xargs -I % sh -c 'ls -l dist/%' + + - name: Choose wheels to upload + if: env.RELEASE == 'true' + shell: sh + run: | + grep -F -x -v -f existing_wheel_list new_wheel_list > upload_wheel_list + cat upload_wheel_list + + - name: Upload wheels + if: env.RELEASE == 'true' + shell: sh + run: | + cat upload_wheel_list | xargs -I % sh -c 'aws s3 cp dist/% s3://download.chia.net/simple/chiavdf/' From e512505fc4d4dd0f967a916cf77abf6c70a10988 Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:41:58 -0800 Subject: [PATCH 2/3] Use correct bucket name --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index ad7c7e4c5..d9ae7dac0 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -123,4 +123,4 @@ jobs: if: env.RELEASE == 'true' shell: sh run: | - cat upload_wheel_list | xargs -I % sh -c 'aws s3 cp dist/% s3://download.chia.net/simple/chiavdf/' + cat upload_wheel_list | xargs -I % sh -c 'aws s3 cp dist/% s3://download.chia.net/simple/chiapos/' From 5ead18671bdc81af3c4617e38dab55d745ea7db9 Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:03:47 -0800 Subject: [PATCH 3/3] Update build-test-riscv64.yml --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index d9ae7dac0..85bb5acb7 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -14,7 +14,7 @@ on: jobs: build_wheels: timeout-minutes: 60 - name: ${{ matrix.os.emoji }} 📦 Build ${{ matrix.python.major-dot-minor }} + name: ${{ matrix.os }} 📦 Build ${{ matrix.python.major-dot-minor }} runs-on: ${{ matrix.os }} strategy: fail-fast: false