Skip to content

fix: fix add dependency #2385

fix: fix add dependency

fix: fix add dependency #2385

Workflow file for this run

name: CI
on:
push: {}
pull_request:
types: [closed]
release:
types: [created]
env:
VERSIONS: "['3.8', '3.9', '3.10', '3.11', '3.12']"
LAST_VERSION: '3.12'
jobs:
set_python_versions:
runs-on: ubuntu-latest
outputs:
all_versions: ${{ steps.step1.outputs.matrix }}
last_version: ${{ steps.step1.outputs.last_version }}
steps:
- name: Set versions
id: step1
run: |
echo "matrix=${{env.VERSIONS}}" >> $GITHUB_OUTPUT
echo "last_version=${{env.LAST_VERSION}}" >> $GITHUB_OUTPUT
run_tests:
runs-on: ubuntu-latest
needs: set_python_versions
strategy:
matrix:
python-version: ${{ fromJSON(needs.set_python_versions.outputs.all_versions) }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip, setuptools, and wheel
run: |
pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libhdf5-serial-dev zlib1g-dev libatlas-base-dev lcov swig3.0 libpcsclite-dev
mkdir -p ~/bin/ && ln -s /usr/bin/swig3.0 ~/bin/swig && export PATH=~/bin/:$PATH
pip install wheel # Ensure wheel is installed
pip install -e .[ci,test,yubikey]
- name: Setup GitHub user
run: |
git config --global user.name oll-bot
git config --global user.email [email protected]
- name: Run pre-commit and test with pytest
run: |
pre-commit run --all-files
pytest taf/tests
build_and_upload_wheel:
runs-on: ubuntu-latest
needs: [set_python_versions, run_tests]
if: github.event_name == 'release'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
# build it on the minimum version
python-version: ${{ fromJSON(needs.set_python_versions.outputs.all_versions)[0] }}
- name: Upgrade pip
run: |
pip install --upgrade pip setuptools wheel
- name: Install swig
run: |
sudo apt-get update
sudo apt-get install libhdf5-serial-dev zlib1g-dev libatlas-base-dev lcov swig3.0 libpcsclite-dev
mkdir -p ~/bin/ && ln -s /usr/bin/swig3.0 ~/bin/swig && export PATH=~/bin/:$PATH
- name: Install and build TAF
run: |
pip install .[yubikey]
python setup.py sdist bdist_wheel clean --all
- name: Install publishing dependencies
run: |
pip install packaging
pip install twine==3.8.0
- name: Upload wheels to PyPI
run: |
twine check dist/*
twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
build-and-test-executables:
needs: [set_python_versions, run_tests]
if: github.event_name == 'release'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Upload URL
id: get_upload_url
run: echo "${{ github.event.release.upload_url }}"
- name: Set up Python
uses: actions/setup-python@v5
with:
# the newest python that we support
python-version: ${{ needs.set_python_versions.outputs.last_version }}
- name: Upgrade pip windows
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Upgrade pip
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
pip install --upgrade pip setuptools wheel
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libhdf5-serial-dev zlib1g-dev libatlas-base-dev lcov swig3.0 libpcsclite-dev
mkdir -p ~/bin/ && ln -s /usr/bin/swig3.0 ~/bin/swig && export PATH=~/bin/:$PATH
- name: Install Windows dependencies
if: matrix.os == 'windows-latest'
run: |
choco install swig
- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: |
brew install swig
- name: Install dependencies
run: |
pip install .[yubikey]
pip install .[executable]
pip install pyinstaller
- name: Build and test standalone executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyinstaller --onefile --hidden-import=yubikey_manager --hidden-import=lxml --collect-submodules taf.tools --name taf-linux -y taf/tools/cli/taf.py
chmod +x dist/taf-linux
./dist/taf-linux --help | grep "TAF Command Line Interface" || { echo "Error: Expected text not found in the executable output"; exit 1; }
- name: Build and test standalone executable (Windows)
if: matrix.os == 'windows-latest'
run: |
pyinstaller --onefile --hidden-import=yubikey_manager --hidden-import=lxml --collect-submodules taf.tools --name taf-windows.exe -y taf/tools/cli/taf.py
./dist/taf-windows.exe --help | Select-String "TAF Command Line Interface" -quiet
- name: Build and test standalone executable (macOS)
if: matrix.os == 'macos-latest'
run: |
pyinstaller --onefile --hidden-import=yubikey_manager --hidden-import=lxml --collect-submodules taf.tools --name taf-macos -y taf/tools/cli/taf.py
./dist/taf-macos --help | grep "TAF Command Line Interface" || { echo "Error: Expected text not found in the executable output"; exit 1; }
- name: Upload standalone executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
gh release upload ${{github.event.release.tag_name}} dist/taf-linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload standalone executable (Windows)
if: matrix.os == 'windows-latest'
run: |
gh release upload ${{github.event.release.tag_name}} dist/taf-windows.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload standalone executable (macOS)
if: matrix.os == 'macos-latest'
run: |
gh release upload ${{github.event.release.tag_name}} dist/taf-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}