Skip to content

Commit

Permalink
Merge pull request #4 from andrewwhitehead/main
Browse files Browse the repository at this point in the history
Update build process
  • Loading branch information
ryjones authored Feb 18, 2021
2 parents 3dfcf5f + dbecf21 commit cc0de8b
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 2,267 deletions.
113 changes: 96 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,70 @@
name: "Build Artifacts"

on: workflow_dispatch
name: "Build Packages"

"on":
release:
types: [created]
workflow_dispatch:
inputs:
publish:
description: "Publish packages"
required: true
default: "false"

defaults:
run:
shell: bash

jobs:
build-lib:
name: Build Library
build-manylinux:
name: Build Library (Manylinux)

strategy:
matrix:
include:
- os: ubuntu-latest
lib: libaries_askar.so
container: andrewwhitehead/manylinux2014-base

container: ${{ matrix.container }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Cache cargo resources
uses: Swatinem/rust-cache@v1

- name: Build library
env:
BUILD_TARGET: ${{ matrix.target }}
run: sh ./build.sh

- name: Upload library artifacts
uses: actions/upload-artifact@v2
with:
name: library-${{ runner.os }}
path: target/release/${{ matrix.lib }}

build-other:
name: Build Library (MacOS/Win)

strategy:
matrix:
include:
- os: macos-latest
lib: libaries_askar.dylib
# target: apple-darwin
toolchain: stable # beta required for aarch64-apple-darwin target
- os: windows-latest
lib: aries_askar.dll
toolchain: stable

runs-on: ${{ matrix.os }}

Expand All @@ -24,14 +76,16 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
toolchain: ${{ matrix.toolchain }}

- name: Cache cargo resources
uses: Swatinem/rust-cache@v1

- name: Build library
run: cargo build --release --locked
env:
BUILD_TARGET: ${{ matrix.target }}
BUILD_TOOLCHAIN: ${{ matrix.toolchain }}
run: sh ./build.sh

- name: Upload library artifacts
uses: actions/upload-artifact@v2
Expand All @@ -41,17 +95,19 @@ jobs:

build-py:
name: Build Python
needs: build-lib
needs: [build-manylinux, build-other]

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6]
include:
- os: ubuntu-latest
plat-name: manylinux2014_x86_64
- os: macos-latest
plat-name: macosx_10_9_x86_64
python-version: 3.6
plat-name: macosx_10_9_x86_64 # macosx_10_9_universal2
- os: windows-latest
plat-name: win32
python-version: 3.6
plat-name: win_amd64

runs-on: ${{ matrix.os }}

Expand All @@ -67,21 +123,44 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine auditwheel
- name: Fetch library artifacts
uses: actions/download-artifact@v2
with:
name: library-${{ runner.os }}
path: wrappers/python/aries_askar/

- name: Build python packages
- name: Build python package
run: |
python setup.py bdist_wheel --plat-name=${{ matrix.plat-name }}
python setup.py bdist_wheel --python-tag=py3 --plat-name=${{ matrix.plat-name }}
working-directory: wrappers/python

- name: Upload python artifacts
- name: Test python package
shell: sh
run: |
cd wrappers/python
pip install --upgrade pip
pip install dist/*
python -m demo.test
- if: "runner.os == 'Linux'"
name: Auditwheel
run: auditwheel show wrappers/python/dist/*

- name: Upload python package
uses: actions/upload-artifact@v2
with:
name: python-${{ runner.os }}
path: wrappers/python/dist/*

- if: |
(github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' &&
github.event.inputs.publish == 'true'))
name: Publish python package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing wrappers/python/dist/*
13 changes: 8 additions & 5 deletions .github/workflows/rusttest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,28 @@ jobs:
with:
profile: minimal
toolchain: stable
override: true

- name: Cache cargo resources
uses: Swatinem/rust-cache@v1

- name: Cargo check
run: cargo check --locked
uses: actions-rs/cargo@v1
with:
command: check

- name: Cargo fmt
run: cargo fmt --all -- --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Debug build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets --locked
args: --all-targets

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --locked
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
target
*.db-shm
*.db-wal
Cargo.lock
Loading

0 comments on commit cc0de8b

Please sign in to comment.