Skip to content

add dependency

add dependency #2

Workflow file for this run

name: Deploy to PyPI
on:
release:
types: [published]
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
# CDA_HOST_NAME: tueicda-cda.srv.mwn.de
# CDA_USER_NAME: web-user
# CDA_TARGET_DIR: /var/www/cda/app/mntbench/
jobs:
build_wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.9"
name: Install Python
- name: Build wheel
run: pipx run build --wheel
- name: Install wheel
run: python -m pip install --verbose dist/*.whl
- name: Run tests
run: |
pip install pytest
pytest -k 'test_flask_server'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
with:
path: dist/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.9"
name: Install Python
- name: Build sdist
run: pipx run build --sdist
- name: Install sdist
run: python -m pip install --verbose dist/*.tar.gz
- name: Run tests
run: |
pip install pytest
pytest -k 'test_flask_server'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
if: github.event_name == 'release' && github.event.action == 'published'
name: 🚀 Deploy to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mnt.bench
permissions:
id-token: write
needs: [build_wheel, build_sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
# upload_webserver:
# needs: upload_pypi
# runs-on: ubuntu-latest
# if: github.event_name == 'release' && github.event.action == 'published'
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Create version file
# run: |
# echo "version = \"$(git describe --tags --always)\"" > mntbench_version.txt
# - name: Setup SSH via the stored Action Secrets
# run: |
# mkdir -p ~/.ssh
# echo "${KNOWN_HOSTS}" >> ~/.ssh/known_hosts
# echo "${DEPLOY_KEY}" > ~/.ssh/my_rsync_key
# echo "IdentityFile ~/.ssh/my_rsync_key" >> ~/.ssh/config
# chmod -R 700 ~/.ssh
# - name: Copy version file to the webserver
# working-directory: ${{ github.workspace }}
# run: |
# rsync -avz -e ssh mntbench_version.txt ${CDA_USER_NAME}@${CDA_HOST_NAME}:${CDA_TARGET_DIR}/mntbench_version.txt