Skip to content

Workflow file for this run

name: Build and Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64]
exclude:
- os: windows-latest
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build Go shared library
working-directory: ./py
run: |
GOOS=${{ runner.os }} GOARCH=${{ matrix.arch }} go build -o dnadesign/libdnadesign.so -buildmode=c-shared lib.go
env:
CGO_ENABLED: 1
- name: Build Python package
working-directory: ./py
run: python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: dist-${{ runner.os }}-${{ matrix.arch }}
path: py/dist/
publish:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: dist
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/**/*/dist/*