Skip to content

Commit

Permalink
Merge pull request #289 from a2i2/config/migration-to-actions
Browse files Browse the repository at this point in the history
CONFIG: Migration to Github Actions
  • Loading branch information
Zac Brannelly authored Aug 22, 2022
2 parents 53b111f + e30ec74 commit 67ca3c4
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 133 deletions.
159 changes: 159 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Build

on:
pull_request:
branches:
- "*"

# Cancel in-progress workflow runs on new PR commits.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
test-library:
name: Build library
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7.5
uses: actions/setup-python@v3
with:
python-version: "3.7.5"
- name: Install tox
run: |
# Install tox
pip install tox==3.20.1
- name: Run tests using tox
run: |
# Go inside the surround library
cd surround
# Remove generated tox directory
rm -rf .tox
# Run tests through tox
tox
test-cli:
name: Build cli
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7.5
uses: actions/setup-python@v3
with:
python-version: "3.7.5"
- name: Install tox
run: |
# Install tox
pip install tox==3.20.1
- name: Run tests using tox
run: |
# Go inside the surround cli
cd surround_cli
# Remove generated tox directory
rm -rf .tox
# Run tests through tox
tox
# Run examples
pip install ../surround
python setup.py install
cd ..
find examples/ -iname "*.py" | xargs pylint
ls examples/ | xargs -n 1 -I '{}' python3 examples/'{}'/main.py
release-library:
name: Release library
runs-on: ubuntu-20.04
needs:
- test-library
if: >-
github.event_name != 'pull_request' &&
github.ref_type == 'tag' &&
startsWith(github.ref_name, 'surround-v')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7.5
uses: actions/setup-python@v3
with:
python-version: "3.7.5"
- name: Publish
run: |
cd surround
# Remove generated files from last release
rm -rf dist
# Install required packages
python -m pip install --user --upgrade setuptools wheel twine
# Setup Pypi config
echo "[distutils]" >> ~/.pypirc
echo "index-servers =" >> ~/.pypirc
echo "pypi" >> ~/.pypirc
echo "surround" >> ~/.pypirc
echo "" >> ~/.pypirc
echo "[pypi]" >> ~/.pypirc
echo "username=__token__" >> ~/.pypirc
echo "password=${{ secrets.PYPI_API_LIB_TOKEN }}" >> ~/.pypirc
echo "" >> ~/.pypirc
echo "[surround]" >> ~/.pypirc
echo "repository = https://upload.pypi.org/legacy/" >> ~/.pypirc
echo "username=__token__" >> ~/.pypirc
echo "password=${{ secrets.PYPI_API_LIB_TOKEN }}" >> ~/.pypirc
# Build package
python setup.py sdist bdist_wheel
# Upload package for distribution
python -m twine upload --repository pypi dist/*
release-cli:
name: Release library
runs-on: ubuntu-20.04
needs:
- test-cli
if: >-
github.event_name != 'pull_request' &&
github.ref_type == 'tag' &&
startsWith(github.ref_name, 'surround-cli-v')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7.5
uses: actions/setup-python@v3
with:
python-version: "3.7.5"
- name: Publish
run: |
cd surround_cli
# Remove generated files from last release
rm -rf dist
# Install required packages
python -m pip install --user --upgrade setuptools wheel twine
# Setup Pypi config
echo "[distutils]" >> ~/.pypirc
echo "index-servers =" >> ~/.pypirc
echo "pypi" >> ~/.pypirc
echo "surround-cli" > ~/.pypirc
echo "" >> ~/.pypirc
echo "[pypi]" >> ~/.pypirc
echo "username=__token__" >> ~/.pypirc
echo "password=${{ secrets.PYPI_API_CLI_TOKEN }}" >> ~/.pypirc
echo "" >> ~/.pypirc
echo "[surround-cli]" >> ~/.pypirc
echo "repository = https://upload.pypi.org/legacy/" >> ~/.pypirc
echo "username=__token__" >> ~/.pypirc
echo "password=${{ secrets.PYPI_API_CLI_TOKEN }}" >> ~/.pypirc
# Build package
python setup.py sdist bdist_wheel
# Upload package for distribution
python -m twine upload --repository pypi dist/*
133 changes: 0 additions & 133 deletions codefresh.yml

This file was deleted.

0 comments on commit 67ca3c4

Please sign in to comment.