Skip to content

Commit

Permalink
Add install checks
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Jan 13, 2023
1 parent 1fcf7f6 commit 82d2bde
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 32 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: _build

on:
workflow_call:
inputs:
python_version:
description: The Python version.
type: string
required: false
default: '3.11'
runs_on:
description: The runner environment.
type: string
required: false
default: ubuntu-latest
outputs:
artifact_name:
description: The artifact name.
value: build-${{ github.sha }}

jobs:
build:
name: Package
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
python_version: ${{ inputs.python_version }}
- name: Build
run: make build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build-${{ github.sha }}
if-no-files-found: error
path: dist/
9 changes: 7 additions & 2 deletions .github/workflows/_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: _publish

on:
workflow_call:
inputs:
artifact_name:
description: The artifact name.
type: string
required: true
secrets:
registry_token:
description: The package registry token.
Expand All @@ -20,10 +25,10 @@ jobs:
uses: ./.github/actions/setup
with:
install_dependencies: 'false'
- name: Download artifacts
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ github.sha }}
name: ${{ inputs.artifact_name }}
path: dist/
- name: Publish
run: poetry publish --skip-existing -u $USERNAME -p $PASSWORD
Expand Down
53 changes: 44 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ jobs:
run: make lint
build:
name: Build (Python ${{ matrix.python }} on ${{ matrix.os_name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
uses: ./.github/workflows/_build.yml
with:
python_version: ${{ matrix.python }}
runs_on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
Expand All @@ -77,12 +79,45 @@ jobs:
os_name: macOS
- os: windows-latest
os_name: Windows
install:
name: Install (Python ${{ matrix.python }} on ${{ matrix.os_name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: build
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
python:
- '3.10'
- '3.11'
include:
- os: ubuntu-latest
os_name: Linux
- os: macos-latest
os_name: macOS
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Setup Python
uses: actions/setup-python@v4
with:
python_version: ${{ matrix.python }}
- name: Build
run: make build
python-version: ${{ matrix.python }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact_name }}
path: .
- name: Get meta
id: meta
run: echo "whl=$(ls *.whl | head -n1)" >> $GITHUB_OUTPUT
- name: Install
run: pip install $PACKAGE
env:
PACKAGE: ${{ steps.meta.outputs.whl }}
- name: Import
run: echo "import $PACKAGE_IMPORT_NAME" > main.py
env:
PACKAGE_IMPORT_NAME: makenew_pypackage
- name: Run
run: python main.py
30 changes: 9 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,21 @@ on:
- v*

jobs:
artifacts:
name: Build artifacts
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: make build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ github.sha }}
if-no-files-found: error
path: dist/
build:
name: Build
uses: ./.github/workflows/_build.yml
release:
name: GitHub Releases
runs-on: ubuntu-latest
timeout-minutes: 30
needs: artifacts
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ github.sha }}
name: ${{ needs.build.outputs.artifact_name }}
path: dist/
- name: Create GitHub release
uses: softprops/action-gh-release@v1
Expand All @@ -49,6 +35,8 @@ jobs:
pypi:
name: PyPI
uses: ./.github/workflows/_publish.yml
needs: artifacts
needs: build
with:
artifact_name: ${{ needs.build.outputs.artifact_name }}
secrets:
registry_token: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 82d2bde

Please sign in to comment.