Skip to content

Commit

Permalink
added github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaserer committed Sep 6, 2021
1 parent 7b626f9 commit cad6a3f
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
skip_list:
- 'yaml'
- 'role-name'
139 changes: 139 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
name: CI

'on':
push:
branches:
- 'develop'
tags-ignore:
- '**'

jobs:
linter:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Lint Code Base
uses: github/super-linter@v3
env:
VALIDATE_ALL_CODEBASE: true
FILTER_REGEX_EXCLUDE: '.*.md'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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 . -c .ansible-lint
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- debian10
- debian11
- ubuntu2004
fail-fast: false

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install Dependencies
run: pip3 install -r requirements.txt

- name: Run Molecule tests
run: molecule test
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
MOLECULE_DISTRO: ${{ matrix.distro }}

merge:
name: Merge to main
runs-on: ubuntu-latest
needs:
- linter
- molecule
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: main

release:
name: Release
runs-on: ubuntu-latest
needs:
- merge
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: main

- name: Create a new tag
uses: phish108/[email protected]
id: autotag
with:
branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

- name: Create a new release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.autotag.outputs.new-tag }}
token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install Ansible
run: pip3 install ansible-base

# - name: Trigger a new import on Galaxy
# run: >
# ansible-galaxy role import
# --token ${{ secrets.GALAXY_API_KEY }}
# --branch main
# $(echo ${{ github.repository }} | cut -d/ -f1)
# $(echo ${{ github.repository }} | cut -d/ -f2)

# notify:
# name: Slack Notifications
# runs-on: ubuntu-latest
# if: ${{ failure() }}
# needs:
# - release
# steps:
# - name: Notify Slack channel on failure
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_ICON: https://github.com/ckaserer/logos/raw/master/ansible.png
# SLACK_USERNAME: ${{ github.repository }}
# SLACK_COLOR: '#ff0033'
# SLACK_FOOTER: ''
...

0 comments on commit cad6a3f

Please sign in to comment.