Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

name: Build Project
description: Build and install project

Expand Down Expand Up @@ -51,28 +53,31 @@ runs:
sudo apt-get update
sudo apt-get install -y python3-venv libffi-dev
python3 -m venv .venv
echo "$(pwd)/.venv/bin" >> "$GITHUB_PATH"
shell: bash

- name: Install dependencies
working-directory: ${{ inputs.source-path }}
run: |
./.venv/bin/pip install --upgrade pip
./.venv/bin/pip install build abi3audit
pip install --upgrade pip
pip install build abi3audit
shell: bash

- name: Generate distribution artifacts
id: dist
working-directory: ${{ inputs.source-path }}
if: ${{ inputs.dist == 'true' }}
if: inputs.dist == 'true'
env:
BUILD_PATH: ${{ inputs.build-path }}
run: |
./.venv/bin/python3 -m build -o "${{ inputs.build-path }}"
./.venv/bin/abi3audit -v \
$(find "${{ inputs.build-path }}" -name "*.whl")
echo "dist-path=${{ inputs.build-path }}" >> "$GITHUB_OUTPUT"
python3 -m build -o "$BUILD_PATH"
abi3audit -v \
$(find "$BUILD_PATH" -name "*.whl")
echo "dist-path=${BUILD_PATH}" >> "$GITHUB_OUTPUT"
shell: bash

- name: Install project
working-directory: ${{ inputs.source-path }}
if: ${{ inputs.install == 'true' }}
run: ./.venv/bin/pip install .
if: inputs.install == 'true'
run: pip install .
shell: bash
42 changes: 42 additions & 0 deletions .github/actions/generate-latest-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-License-Identifier: Apache-2.0

name: 'Generate Latest Artifacts'
description: 'Generate latest artifacts by replacing version with "latest"'

inputs:
local-path:
description: 'Local path where the artifacts are'
default: 'build'

runs:
using: 'composite'
steps:
- name: Generate latest artifacts
env:
LOCAL_PATH: ${{ inputs.local-path }}
run: |
# Attempt to match filenames of the form
# pkg-A.B.C[.postD.devE+gF{9}][.dG{8}][moretext].extension
# where capital letters are numbers, F is 9 digits and G is 8 digits long
BASE_RE='\d+\.\d+\.\d+' # base version: A.B.C
POST_RE='\.post\d+\.dev\d+\+g[\da-z].{8}' # post abbr: .postD.devE+gF{9}
DATE_RE='\.d[\d].{7}' # date: .dG{8}
VERSION_REGEX="([^\d]+)${BASE_RE}(${POST_RE})*(${DATE_RE})*([^.]*\..+)"

if [ -d "$LOCAL_PATH" ]; then
echo "Local path is a directory, skipping"
exit 0
fi

dir=$(dirname "$LOCAL_PATH")
files=$(basename "$LOCAL_PATH")
pushd "${dir}"
for f in $(find . -maxdepth 1 -type f -name "${files}"); do
latest_filename=$(echo "$f" | \
perl -pe "s/${VERSION_REGEX}/\1latest\4/g")

echo "Copying $f to ${latest_filename}"
cp "$f" "$latest_filename"
done
popd
shell: bash
16 changes: 11 additions & 5 deletions .github/actions/run-examples/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

name: Run Examples
description: Run vaccel examples

Expand All @@ -18,12 +20,16 @@ runs:
- name: Ensure run dir exists
run: |
uid=$(id -u)
[ -d "/run/user/${uid}" ] && exit 0
sudo mkdir -p "/run/user/${uid}"
sudo chown -R "${uid}" "/run/user/${uid}"
run_dir="/run/user/${uid}"

if [[ -d "$run_dir" ]]; then
exit 0
fi

sudo mkdir -p "$run_dir"
sudo chown -R "$uid" "$run_dir"
shell: bash

- name: Run examples
run: |
./.venv/bin/python3 run-examples.py
run: python3 run-examples.py
shell: bash
31 changes: 14 additions & 17 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

name: Run Tests
description: Run project tests and generate coverage report

Expand All @@ -21,38 +23,33 @@ runs:
- name: Install dependencies
working-directory: ${{ inputs.source-path }}
run: |
# FIXME: This should be in the vaccel coverage workflow
if ! dpkg -s vaccel &> /dev/null; then
wget "https://s3.nbfc.io/nbfc-assets/github/vaccel/rev/main/x86_64/release/vaccel_latest_amd64.deb"
sudo apt install ./vaccel_latest_amd64.deb
rm vaccel_latest_amd64.deb
fi

# Use pre-meson NumPy so our arm jammy runners will work correctly
./.venv/bin/pip install "numpy<1.25"
pip install "numpy<1.25"

arch=$(python3 -c "import platform; print(platform.architecture()[0])")
if [[ "${arch}" == "32bit" ]]; then
./.venv/bin/pip install .[test]
pip install .[test]
else
./.venv/bin/pip install .[test-full]
pip install .[test-full]
fi
shell: bash

- name: Run tests
working-directory: ${{ inputs.source-path }}
run: ./.venv/bin/python3 -m pytest
run: python3 -m pytest
shell: bash

- name: Calculate coverage
working-directory: ${{ inputs.source-path }}
if: ${{ inputs.coverage == 'true' }}
if: inputs.coverage == 'true'
env:
BUILD_PATH: ${{ inputs.build-path }}
run: |
./.venv/bin/pip install tomli
pkg_name=$(./.venv/bin/python3 -c \
pip install tomli
pkg_name=$(python3 -c \
"import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['name'])")
./.venv/bin/python3 -m pytest \
python3 -m pytest \
--cov-report term \
--cov-report xml:"${{ inputs.build-path }}/coverage.xml" \
--cov="${pkg_name}" tests/
--cov-report xml:"${BUILD_PATH}/coverage.xml" \
--cov="$pkg_name" tests/
shell: bash
74 changes: 0 additions & 74 deletions .github/actions/upload-to-s3/action.yml

This file was deleted.

9 changes: 8 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
directories:
- "/"
# Workaround for https://github.com/dependabot/dependabot-core/issues/6345
- "/.github/actions/*"
schedule:
interval: "monthly"
groups:
github-actions:
patterns:
- "*"
commit-message:
prefix: "ci(deps)"
Loading
Loading