CI #374
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 5 * * 1" | |
defaults: | |
run: | |
working-directory: 'gmazoyer.netbox' | |
jobs: | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: 'gmazoyer.netbox' | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
pip3 install ansible ansible-lint | |
- name: Lint code | |
run: ansible-lint -p . | |
molecule: | |
name: molecule | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
distro: | |
- debian12 | |
- ubuntu2204 | |
- ubuntu2404 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: 'gmazoyer.netbox' | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
pip3 install ansible molecule molecule-plugins[docker] docker | |
- name: Run Molecule | |
run: molecule test | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
MOLECULE_DISTRO: ${{ matrix.distro }} | |
galaxy: | |
name: galaxy import | |
runs-on: ubuntu-latest | |
needs: [lint, molecule] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: 'gmazoyer.netbox' | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
pip3 install ansible | |
- name: Trigger Galaxy import | |
run: >- | |
ansible-galaxy role import | |
--token ${{ secrets.GALAXY_API_KEY }} | |
$(echo ${GITHUB_REPOSITORY} | cut -d/ -f1) | |
$(echo ${GITHUB_REPOSITORY} | cut -d/ -f2) |