Update actions in GitHub workflows #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: snapbtrex Test build and publish | |
# Run this workflow every time a new commit pushed to your repository | |
on: push | |
jobs: | |
# Set the job key. The key is displayed as the job name | |
# when a job name is not provided | |
snap-test: | |
# Name the Job | |
name: Test Snapshoting and local transfers | |
# Set the type of machine to run on | |
runs-on: ubuntu-latest | |
steps: | |
# Checks out a copy of your repository on the ubuntu-latest machine | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install pv dependency | |
run: sudo apt-get install pv | |
- name: Setup SSH | |
run: | | |
ssh-keygen -t rsa -b 4096 -N '' -f ~/.ssh/id_rsa | |
cat ~/.ssh/id_rsa.pub | tee -a ~/.ssh/authorized_keys | |
chmod 600 ~/.ssh/authorized_keys | |
chmod 700 ~/.ssh | |
sudo chmod -c 0755 ~/ | |
- name: Test SSH connection to localhost | |
run: ssh -vv -i ~/.ssh/id_rsa -o BatchMode=yes -o StrictHostKeyChecking=no $(whoami)@localhost | |
- name: Install local Package | |
run: python3 -m pip install ./snapbtrex | |
- name: Check if help is displayed | |
run: snapbtrex --help | |
- name: Check if safety net works is displayed | |
run: snapbtrex | |
- name: check if explanation is given | |
run: snapbtrex --explain | |
- name: run few internal tests | |
run: | | |
snapbtrex --test --path . --verbose --target-freespace 1 -S --keep-backups=3 | |
snapbtrex --test --path . --verbose --target-freespace 50T -S --keep-backups=3 | |
snapbtrex --test --path . --verbose --max-age 20w --target-backups 4 -S --keep-backups=3 | |
snapbtrex --test --path . --verbose --max-age 20y --target-backups 2 -S --keep-backups=3 | |
- name: Run snapshot test | |
run: sudo ./tests/testsnap.sh | |
snapbtrex-build-and-publish: | |
# Name the Job | |
name: Build snapbtrex and publish | |
# Set the type of machine to run on | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
- name: Install build and test dependencies | |
run: python -m pip install --user --upgrade setuptools wheel pytest pytest-cov | |
#- name: Run python tests | |
# run: python -m pytest | |
- name: Build | |
run: python setup.py sdist bdist_wheel | |
- name: Publish package to TestPyPI | |
uses: pypa/gh-action-pypi-publish@mastermaster | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
- name: Test install | |
run: python -m pip install --user --upgrade -i https://test.pypi.org/simple/ snapbtrex | |
- name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |