build: build static linux binary using repo #19
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, Sign & Publish | |
on: | |
push: | |
pull_request: | |
jobs: | |
build-linux-amd64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y \ | |
build-essential wget m4 xz-utils \ | |
make cmake libomp-dev libeigen3-dev \ | |
libgmp-dev libmpfr-dev fplll-tools libfplll-dev libeigen3-dev libopenblas-dev | |
- name: Build Wheel | |
run: | | |
./build.sh | |
- name: Test the Package | |
run: | | |
./test.sh | |
- name: Upload wheel artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-amd64-linux | |
path: dist/*.whl | |
build-linux-arm64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update -y | |
sudo apt install -y \ | |
build-essential wget m4 xz-utils \ | |
make cmake libomp-dev libeigen3-dev \ | |
libgmp-dev libmpfr-dev fplll-tools libfplll-dev libeigen3-dev libopenblas-dev | |
- name: Build wheel | |
run: | | |
./build.sh | |
- name: Test the Package | |
run: | | |
./test.sh | |
- name: Upload Wheel Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-arm64-linux | |
path: dist/*.whl | |
build-darwin-arm64: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
brew install make wget cmake | |
brew install eigen | |
- name: Build wheel | |
run: | | |
./build.sh | |
- name: Test the package | |
run: | | |
./test.sh | |
- name: Upload wheel artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-arm64-darwin | |
path: dist/*.whl | |
collect-artifacts: | |
name: Collect Build Artifacts | |
needs: | |
- build-linux-amd64 | |
- build-linux-arm64 | |
- build-darwin-arm64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: wheel-* | |
path: dist/ | |
merge-multiple: true | |
- name: Upload merged artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: dist/ | |
publish-to-pypi: | |
name: >- | |
Publish to PyPI | |
needs: | |
- collect-artifacts | |
# only publish on tags | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/flatn | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
github-release: | |
name: Sign & Create Release | |
needs: | |
- publish-to-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: dist/ | |
- name: Sign the distribution with SigStore | |
uses: sigstore/gh-action-sigstore-python@v3.0.0 | |
with: | |
inputs: >- | |
./dist/*.whl | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release create | |
"$GITHUB_REF_NAME" | |
--repo "$GITHUB_REPOSITORY" | |
--notes "" | |
- name: Upload artifact signatures to GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release upload | |
"$GITHUB_REF_NAME" dist/** | |
--repo "$GITHUB_REPOSITORY" | |
publish-to-testpypi: | |
name: >- | |
Publish to TestPyPI | |
needs: | |
- collect-artifacts | |
# only test publish on master branch | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/flatn | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: dist/ | |
- name: Publish distribution to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |