Skip to content

Commit

Permalink
Merge pull request #40 from Chia-Network/publish-job
Browse files Browse the repository at this point in the history
Add a publish job for clvm wheels
  • Loading branch information
Starttoaster authored Sep 27, 2023
2 parents bbc4523 + b15df3b commit 90bd6fa
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 29 deletions.
45 changes: 34 additions & 11 deletions .github/workflows/build-m1-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,32 @@ jobs:
name: wheels
path: ./target/wheels

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"
upload:
name: Upload to 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: Install python
uses: Chia-Network/actions/setup-python@main
with:
python-version: "3.10"

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: wheels
path: ./target/wheels/

- name: publish (PyPi)
if: env.RELEASE == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -142,6 +152,17 @@ jobs:
packages-dir: target/wheels/
skip-existing: true

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"

- name: Configure AWS credentials
if: steps.check_secrets.outputs.HAS_AWS_SECRET
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -151,8 +172,10 @@ jobs:

- name: Publish Dev
if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/dev'
shell: bash
working-directory: ./target/wheels
run: |
FILES=$(find ${{ github.workspace }}/target/wheels -type f -name '*.whl')
FILES=$(find . -type f -name '*.whl')
while IFS= read -r file; do
filename=$(basename $file)
aws --no-progress s3 cp "$file" "s3://download.chia.net/simple-dev/clvm-tools-rs/$filename"
Expand Down
57 changes: 39 additions & 18 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,43 +223,70 @@ jobs:
rustup component add llvm-tools-preview
python ./resources/coverage/run_coverage.py --require-percent 60
- name: Build alpine wheel via docker
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: |
cd resources/alpine && docker build -t clvm-tools-rs-alpine .
docker run -v ${GITHUB_WORKSPACE}:/root/clvm_tools_rs -t clvm-tools-rs-alpine sh /root/build-alpine.sh
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./target/wheels/

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"
upload:
name: Upload to 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: publish (PyPi)
- name: Install python
uses: Chia-Network/actions/setup-python@main
with:
python-version: "3.10"

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: wheels
path: ./target/wheels/

- name: Publish distribution to PyPI
if: env.RELEASE == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: target/wheels/
skip-existing: true

- name: publish (Test PyPi)
- name: Publish distribution to Test PyPI
if: env.PRE_RELEASE == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: target/wheels/
skip-existing: true

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"

- name: Configure AWS credentials
if: steps.check_secrets.outputs.HAS_AWS_SECRET
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -278,12 +305,6 @@ jobs:
aws --no-progress s3 cp "$file" "s3://download.chia.net/simple-dev/clvm-tools-rs/$filename"
done <<< "$FILES"
- name: Build alpine wheel via docker
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: |
cd resources/alpine && docker build -t clvm-tools-rs-alpine .
docker run -v ${GITHUB_WORKSPACE}:/root/clvm_tools_rs -t clvm-tools-rs-alpine sh /root/build-alpine.sh
fmt:
runs-on: ubuntu-20.04
name: cargo fmt
Expand Down

0 comments on commit 90bd6fa

Please sign in to comment.