fix: add --force for local install #51
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: CI | |
"on": | |
push: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
env: | |
ANSIBLE_HOST_KEY_CHECKING: "False" | |
ANSIBLE_FORCE_COLOR: "1" | |
PY_COLORS: "1" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install openssh | |
run: | | |
sudo apt update | |
sudo apt install -y openssh-server openssh-client | |
- name: Generate openssh key and trust it | |
run: | | |
mkdir ~/.ssh | |
chmod 0700 ~/.ssh | |
ssh-keygen -f ~/.ssh/id_rsa </dev/null | |
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys | |
chmod 0600 ~/.ssh/* | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry==1.3.2 | |
- name: Install deps | |
run: poetry install | |
- name: Run local tests | |
run: poetry run molecule converge | |
- name: Create directory for clean build | |
run: mkdir -p ansible_collections/serverscom/mitogen | |
- name: Copy production files | |
run: cp -r README.md plugins meta galaxy.yml --target-directory=ansible_collections/serverscom/mitogen | |
- name: Packaging | |
run: poetry run ansible-galaxy collection build | |
working-directory: ansible_collections/serverscom/mitogen | |
- name: Extract version | |
id: version | |
run: | | |
version=$(grep ^version galaxy.yml|awk '{print $2}') | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
- name: Try to install collection | |
run: poetry run ansible-galaxy collection install serverscom-mitogen-${{ steps.version.outputs.version }}.tar.gz --force | |
working-directory: ansible_collections/serverscom/mitogen | |
- name: Run with strategy stanza in play | |
run: poetry run ansible-playbook -i inventory.yaml test1.yaml | |
working-directory: integration_tests | |
- name: Run with strategy in environment variable | |
run: poetry run ansible-playbook -i inventory.yaml test1.yaml -vvv|grep ansible_mitogen.connection >/dev/null | |
working-directory: integration_tests | |
env: | |
ANSIBLE_STRATEGY: serverscom.mitogen.mitogen_linear | |
- name: Run bug-specific tests | |
run: poetry run ansible-playbook -i inventory.yaml test3.yaml | |
working-directory: integration_tests | |
env: | |
ANSIBLE_STRATEGY: serverscom.mitogen.mitogen_linear | |
- name: Publish on Galaxy | |
if: ${{ endsWith(github.ref, steps.version.outputs.version) }} | |
run: | |
poetry run ansible-galaxy collection publish | |
serverscom-mitogen-${{ steps.version.outputs.version }}.tar.gz | |
--api-key="${{ secrets.GALAXY_API_TOKEN }}" | |
working-directory: ansible_collections/serverscom/mitogen |