From 1bd40c3d3c5e0477f6e5c7588ce3ef8f5bdda859 Mon Sep 17 00:00:00 2001 From: Renata Date: Wed, 26 Jun 2024 00:53:59 -0400 Subject: [PATCH] test --- .github/workflows/deploy.yml | 254 ++++++++++++++++++----------------- 1 file changed, 132 insertions(+), 122 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e92e93a2..bc632842 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,154 +9,164 @@ on: - '**' jobs: - build_and_upload_wheel: + # build_and_upload_wheel: + # strategy: + # matrix: + # # python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + # python-version: ['3.10'] + + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v3 + # with: + # python-version: ${{ matrix.python-version }} + + # - name: Set up Python + # uses: actions/setup-python@v3 + # with: + # python-version: ${{ matrix.python-version }} + + # - 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 to TestPyPi + # # if: startsWith(github.ref, 'refs/tags/v') + # run: | + # twine upload --repository-url https://test.pypi.org/legacy/ dist/* + # env: + # TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} + # TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} + + + # - name: Upload wheels to PyPI + # if: startsWith(github.ref, 'refs/tags/v') + # run: | + # python -m pip install twine + # twine check dist/* + # twine upload --skip-existing dist/* -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} + # env: + # PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} + # PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + # displayName: "Upload wheels" + + + build-and-test-executables: strategy: matrix: - # python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - python-version: ['3.10'] - - runs-on: ubuntu-latest + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + if: ${{ needs.run-tests.result == 'success' }} steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: '3.x' + + - 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 swig + - 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 and build TAF + - 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] - python setup.py sdist bdist_wheel clean --all + pip install pyinstaller - - name: Install publishing dependencies + - name: Build and test standalone executable (Linux) + if: matrix.os == 'ubuntu-latest' run: | - pip install packaging - pip install twine==3.8.0 + pyinstaller --onefile --name taf -y taf/tools/cli/taf.py + chmod +x dist/taf + ./dist/taf --help | grep "TAF Command Line Interface" || { echo "Error: Expected text not found in the executable output"; exit 1; } - - name: Upload to TestPyPi - # if: startsWith(github.ref, 'refs/tags/v') + - name: Build and test standalone executable (Windows) + if: matrix.os == 'windows-latest' run: | - twine upload --repository-url https://test.pypi.org/legacy/ dist/* + pyinstaller --onefile --name taf.exe -y taf/tools/cli/taf.py + ./dist/taf.exe --help | Select-String "TAF Command Line Interface" -quiet + + - name: Build and test standalone executable (macOS) + if: matrix.os == 'macos-latest' + run: | + pyinstaller --onefile --name taf -y taf/tools/cli/taf.py + ./dist/taf --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' + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: dist/taf + asset_name: taf-linux env: - TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Upload wheels to PyPI - # if: startsWith(github.ref, 'refs/tags/v') - # run: | - # python -m pip install twine - # twine check dist/* - # twine upload --skip-existing dist/* -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} - # env: - # PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} - # PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - # displayName: "Upload wheels" + - name: Upload standalone executable (Windows) + if: matrix.os == 'windows-latest' + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: dist/taf.exe + asset_name: taf-windows + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload standalone executable (macOS) + if: matrix.os == 'macos-latest' + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: dist/taf + asset_name: taf-macos + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# build-and-test-executables: -# needs: run-tests -# strategy: -# matrix: -# os: [ubuntu-latest, windows-latest, macos-latest] -# runs-on: ${{ matrix.os }} - -# if: ${{ needs.run-tests.result == 'success' }} -# steps: -# - name: Checkout Repository -# uses: actions/checkout@v3 - -# - name: Set up Python -# uses: actions/setup-python@v2 -# with: -# python-version: '3.10' - -# - 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 pyinstaller - -# - name: Build and test standalone executable (Linux) -# if: matrix.os == 'ubuntu-latest' -# run: | -# pyinstaller --onefile --name taf -y taf/tools/cli/taf.py -# chmod +x dist/taf -# ./dist/taf --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 --name taf.exe -y taf/tools/cli/taf.py -# ./dist/taf.exe --help | Select-String "TAF Command Line Interface" -quiet - -# - name: Build and test standalone executable (macOS) -# if: matrix.os == 'macos-latest' -# run: | -# pyinstaller --onefile --name taf -y taf/tools/cli/taf.py -# ./dist/taf --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' -# uses: actions/upload-artifact@v3 -# with: -# name: taf-executable-linux -# path: dist/taf - -# - name: Upload standalone executable (Windows) -# if: matrix.os == 'windows-latest' -# uses: actions/upload-artifact@v3 -# with: -# name: taf-executable-windows -# path: dist/taf.exe - -# - name: Upload standalone executable (macOS) -# if: matrix.os == 'macos-latest' -# uses: actions/upload-artifact@v3 -# with: -# name: taf-executable-macos -# path: dist/taf