CI #1565
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: | |
- master | |
schedule: | |
- cron: '0 0 * * *' | |
defaults: | |
run: | |
working-directory: 'aminvakil.node_exporter' | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@main | |
with: | |
path: 'aminvakil.node_exporter' | |
- name: Set up Python 3. | |
uses: actions/setup-python@main | |
with: | |
python-version: '3.x' | |
- name: Install test dependencies. | |
run: pip3 install yamllint ansible-core ansible-lint --pre | |
- name: Lint code. | |
run: | | |
yamllint . | |
ansible-lint . | |
molecule: | |
name: Molecule | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- distro: debian12 | |
- distro: debian11 | |
- distro: ubuntu24.04 | |
- distro: ubuntu22.04 | |
- distro: ubuntu20.04 | |
- distro: fedora | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@main | |
with: | |
path: 'aminvakil.node_exporter' | |
- name: Set up Python 3. | |
uses: actions/setup-python@main | |
with: | |
python-version: '3.x' | |
- name: Install test dependencies. | |
run: pip3 install ansible molecule-plugins[docker] docker 'requests<2.32.0' | |
- name: Run Molecule tests. | |
run: molecule test | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
MOLECULE_DISTRO: ${{ matrix.distro }} | |
deploy: | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
needs: [lint, molecule] | |
name: Push to Galaxy | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@main | |
with: | |
path: 'aminvakil.node_exporter' | |
- name: Set up Python 3. | |
uses: actions/setup-python@main | |
with: | |
python-version: '3.x' | |
- name: Install ansible-core. | |
run: pip3 install ansible-core | |
- name: Push to Ansible Galaxy. | |
run: ansible-galaxy role import --token ${{ secrets.GALAXY_API_KEY }} $(echo $GITHUB_REPOSITORY | cut -d/ -f1) $(echo $GITHUB_REPOSITORY | cut -d/ -f2) |