-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Provide continuous delivery (CD). | ||
# | ||
# CD deliverables currently include: | ||
# - Cuba shared library (built from C sources); | ||
# | ||
name: continuous-delivery | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+.post[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+.dev[0-9]+' | ||
paths: | ||
- .github/workflows/cd.yml | ||
workflow_dispatch: | ||
inputs: | ||
rebuild_sharedlib: | ||
description: 'Rebuild shared library' | ||
type: boolean | ||
default: false | ||
required: false | ||
version_tag: | ||
description: 'Version tag for delivery' | ||
type: string | ||
required: false | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_sharedlib: | ||
name: Build shared library | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
compiler: [gcc, llvm] | ||
exclude: | ||
- os: ubuntu-latest | ||
compiler: llvm | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
timeout-minutes: 20 | ||
|
||
if: > | ||
github.event_name != 'workflow_dispatch' || | ||
github.event.inputs.rebuild_sharedlib == 'true' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Override compiler (macOS) | ||
if: runner.os == 'macOS' | ||
run: | | ||
if [ "${{ matrix.compiler }}" == 'gcc' ]; then | ||
export CC=$(find $(brew --prefix gcc)/bin -type f -name 'gcc*') | ||
fi | ||
if [ "${{ matrix.compiler }}" == 'llvm' ]; then | ||
export CC=$(brew --prefix llvm@15)/bin/clang | ||
fi | ||
- name: Build shared library | ||
run: ./make_sharedlib.sh | ||
|
||
- name: Upload shared library | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libcuba-${{ github.ref_name }} | ||
path: dist/libcuba.* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Perform continuous integration (CI) checks. | ||
# | ||
# CI tasks include but are not limited to: | ||
# - development builds (on all supported OS); | ||
# - unit/integration tests; | ||
# - code linting. | ||
# | ||
name: continuous-integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- src/** | ||
- patches/** | ||
- make* | ||
- config* | ||
- setup.py | ||
- pyproject.toml | ||
- .gitignore | ||
- .github/workflows/ci.yml | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
paths: | ||
- src/** | ||
- patches/** | ||
- make* | ||
- config* | ||
- setup.py | ||
- pyproject.toml | ||
- .gitignore | ||
- .github/workflows/ci.yml | ||
pull_request_review: | ||
types: [submitted, edited] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-test-dev: | ||
name: Build & test (in dev mode) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
timeout-minutes: 20 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Python build requirements | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Build and install | ||
run: python -m pip install --editable . -vvv | ||
|
||
- name: Demo test | ||
run: python -c "from pycuba import demo; demo()" | ||
|
||
lint: | ||
name: Lint | ||
|
||
runs-on: ubuntu-latest | ||
|
||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Python linting requirements | ||
run: python -m pip install flake8 | ||
|
||
- name: Lint | ||
run: | | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 . --count --exit-zero --statistics |