ci SED to change package link #13
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: Run Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Create config file | |
run: | | |
echo "playbook_dir: ./test_playbooks" > ansible_link/config.yml | |
echo "inventory_file: ./test_inventory.ini" >> ansible_link/config.yml | |
echo "job_storage_dir: ./test_job_storage" >> ansible_link/config.yml | |
mkdir -p test_playbooks test_job_storage | |
touch test_inventory.ini | |
- name: Create test playbook | |
run: | | |
echo "- hosts: localhost" > test_playbooks/test_playbook.yml | |
echo " tasks:" >> test_playbooks/test_playbook.yml | |
echo " - name: Output OK" >> test_playbooks/test_playbook.yml | |
echo " debug:" >> test_playbooks/test_playbook.yml | |
echo " msg: PLAYBOOK RUN OK" >> test_playbooks/test_playbook.yml | |
- name: Set PYTHONPATH and ANSIBLE_API_CONFIG | |
run: | | |
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
echo "ANSIBLE_API_CONFIG=$GITHUB_WORKSPACE/ansible_link/config.yml" >> $GITHUB_ENV | |
- name: Show structure and environment | |
run: | | |
ls -R | |
echo "PYTHONPATH: $PYTHONPATH" | |
echo "ANSIBLE_API_CONFIG: $ANSIBLE_API_CONFIG" | |
- name: Update import in ansible_link.py | |
run: | | |
sed -i 's/from webhook import WebhookSender/from ansible_link.webhook import WebhookSender/' ansible_link/ansible_link.py | |
- name: Run tests | |
run: | | |
python -m unittest discover tests |