Skip to content

shift to using workflow_call #4950

shift to using workflow_call

shift to using workflow_call #4950

Workflow file for this run

name: PR Tests - HAGrid
on:
workflow_call:
pull_request:
branches:
- dev
- main
- "0.8"
concurrency:
group: hagrid-${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || github.workflow_ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./packages/hagrid
jobs:
pr-tests-hagrid:
strategy:
max-parallel: 99
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11"]
include:
- python-version: "3.9"
os: "ubuntu-latest"
- python-version: "3.10"
os: "ubuntu-latest"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: steps.changes.outputs.hagrid == 'true'
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
if: steps.changes.outputs.hagrid == 'true'
run: |
python -m pip install --upgrade --user pip
- name: Get pip cache dir
id: pip-cache
if: steps.changes.outputs.hagrid == 'true'
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
if: steps.changes.outputs.hagrid == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('packages/hagrid/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-
- name: Install Dependencies
if: steps.changes.outputs.hagrid == 'true'
run: |
pip install --upgrade tox bandit safety setuptools packaging wheel twine pytest
pip install -e .
# 42923 is ansible 7.4.0 (latest 2023.04.14)
- name: Scan for security issues python 3.8+
if: steps.changes.outputs.hagrid == 'true'
run: |
bandit -r hagrid
safety check -i 42923 -i 54229 -i 54230 -i 54230 -i 54229 -i 62044
- name: Run normal tests
if: steps.changes.outputs.hagrid == 'true'
run: |
pytest --durations=50
- name: Run hagrid debug
if: steps.changes.outputs.hagrid == 'true'
run: |
hagrid debug
- name: Run hagrid quickstart
if: steps.changes.outputs.hagrid == 'true'
run: |
hagrid quickstart --reset --quiet --test
- name: Build Wheel
if: steps.changes.outputs.hagrid == 'true'
run: |
python setup.py bdist_wheel
- name: Twine Check
if: steps.changes.outputs.hagrid == 'true'
run: |
twine check dist/*.whl
pr-tests-syft-hagrid-comptability:
strategy:
max-parallel: 99
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
syft-version: ["0.8.2", "0.8.2b6", "0.8.3"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: steps.changes.outputs.hagrid == 'true'
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
if: steps.changes.outputs.hagrid == 'true'
run: |
python -m pip install --upgrade --user pip
- name: Get pip cache dir
id: pip-cache
if: steps.changes.outputs.hagrid == 'true'
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
if: steps.changes.outputs.hagrid == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('packages/syft/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('packages/syft/setup.cfg') }}
# https://github.com/google/jax/issues/17693
# pinning ml-dtypes due to jax version==0.4.10
- name: Install Syft ${{ matrix.syft-version }}
if: steps.changes.outputs.hagrid == 'true'
run: |
pip install ml-dtypes==0.2.0
pip install syft==${{ matrix.syft-version }}
pip install .
- name: Run Orchestra Command
if: steps.changes.outputs.hagrid == 'true'
run: |
python -c "import syft as sy; domain1 = sy.orchestra.launch(name='test-domain-1', dev_mode=True, reset=True)"
python -c "import syft as sy; domain2 = sy.orchestra.launch(name='test-domain-2',dev_mode=False, reset=True)"