mirror of
https://github.com/HanXHX/ansible-mysql.git
synced 2026-03-02 10:42:09 +07:00
👷 Add Github Action
This commit is contained in:
49
.github/workflows/ci.yml
vendored
Normal file
49
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
name: ci
|
||||||
|
'on':
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
yaml-lint:
|
||||||
|
name: YAML Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Fetch code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install test dependencies.
|
||||||
|
run: pip3 install yamllint
|
||||||
|
|
||||||
|
- name: Lint code.
|
||||||
|
run: |
|
||||||
|
yamllint .
|
||||||
|
|
||||||
|
ansible-lint:
|
||||||
|
name: Ansible Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Fetch code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install lib dependencies
|
||||||
|
run: pip3 install netaddr
|
||||||
|
|
||||||
|
- name: Run ansible-lint
|
||||||
|
uses: ansible/ansible-lint@v24.7.0
|
||||||
17
.github/workflows/galaxy.yml
vendored
Normal file
17
.github/workflows/galaxy.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
name: Deploy on Ansible Galaxy
|
||||||
|
|
||||||
|
'on':
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Fetch code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: galaxy
|
||||||
|
uses: robertdebock/galaxy-action@1.2.0
|
||||||
|
with:
|
||||||
|
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
||||||
40
.github/workflows/molecule.yml
vendored
Normal file
40
.github/workflows/molecule.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: Molecule
|
||||||
|
|
||||||
|
'on':
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
scenario:
|
||||||
|
- debian12_master_slave
|
||||||
|
- debian12_upstream
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: "${{ github.repository }}"
|
||||||
|
|
||||||
|
- name: Set up Python 3.
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install lib dependencies
|
||||||
|
run: pip3 install netaddr
|
||||||
|
|
||||||
|
- name: Molecule
|
||||||
|
uses: gofrolist/molecule-action@v2
|
||||||
|
with:
|
||||||
|
molecule_options: --base-config molecule/_shared/base.yml
|
||||||
|
molecule_args: --scenario-name ${{ matrix.scenario }}
|
||||||
|
env:
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
@@ -10,6 +10,9 @@ scenario:
|
|||||||
- idempotence
|
- idempotence
|
||||||
- verify
|
- verify
|
||||||
- destroy
|
- destroy
|
||||||
|
dependency:
|
||||||
|
name: shell
|
||||||
|
command: "${MOLECULE_SCENARIO_DIRECTORY}/../_shared/tools/install-dependencies.sh"
|
||||||
driver:
|
driver:
|
||||||
name: docker
|
name: docker
|
||||||
role_name_check: 1
|
role_name_check: 1
|
||||||
|
|||||||
8
molecule/_shared/tools/install-dependencies.sh
Executable file
8
molecule/_shared/tools/install-dependencies.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "${IS_GITHUB_ACTIONS}" ]; then
|
||||||
|
echo "This script is run in GitHub Actions."
|
||||||
|
pip install netaddr
|
||||||
|
fi
|
||||||
|
|
||||||
|
ansible-galaxy collection install -r requirements.yml
|
||||||
Reference in New Issue
Block a user