Skip to content

Commit

Permalink
refactor CICD workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwizard242 committed May 18, 2023
1 parent a04c3f9 commit 99b25af
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
schedule:
- cron: '0 12 * * *'

env:
CUSTOM_DIR: 'darkwizard242.crictl'

jobs:

Expand All @@ -28,13 +30,13 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3
with:
path: 'darkwizard242.crictl'
path: '${{ env.CUSTOM_DIR }}'
fetch-depth: 0

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: 'darkwizard242.crictl'
projectBaseDir: '${{ env.CUSTOM_DIR }}'
args: >
-Dsonar.projectVersion=${{ github.ref }}_${{ github.run_number }}
env:
Expand All @@ -47,7 +49,7 @@ jobs:
name: Build & Test
runs-on: ubuntu-22.04
strategy:
max-parallel: 6
max-parallel: 10
matrix:
IMAGE: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, rockylinux-8, centos-7, debian-bullseye, debian-buster]

Expand All @@ -56,7 +58,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3
with:
path: 'darkwizard242.crictl'
path: '${{ env.CUSTOM_DIR }}'

- name: Set up Python 3.10
uses: actions/setup-python@v3
Expand All @@ -67,10 +69,10 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install python3-setuptools -y
pip3 install -U pip wheel ansible molecule molecule-plugins[docker] docker yamllint ansible-lint flake8 pytest-testinfra
pip3 install -U -r $CUSTOM_DIR/requirements.txt
- name: Execute Molecule test of role for ${{ matrix.IMAGE }}
working-directory: 'darkwizard242.crictl'
working-directory: '${{ env.CUSTOM_DIR }}'
run: DISTRO=${{ matrix.IMAGE }} molecule test
env:
PY_COLORS: '1'
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- '*'

env:
CUSTOM_DIR: 'darkwizard242.crictl'

jobs:

release:
Expand All @@ -17,7 +20,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3
with:
path: 'darkwizard242.awless'
path: '${{ env.CUSTOM_DIR }}'

- name: Set up Python 3.10
uses: actions/setup-python@v3
Expand All @@ -31,5 +34,5 @@ jobs:
pip3 install -U pip wheel ansible
- name: Import to Ansible Galaxy.
working-directory: 'darkwizard242.awless'
working-directory: '${{ env.CUSTOM_DIR }}'
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} ${{ github.repository_owner }} $(echo ${{ github.repository }} | sed 's/.*\///')
11 changes: 11 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pip
wheel
ansible
molecule
molecule-plugins[docker]
docker
yamllint
ansible-lint
flake8
pytest-testinfra
requests<2.29.0

0 comments on commit 99b25af

Please sign in to comment.