Skip to content

build-and-test

build-and-test #732

name: build-and-test
on:
pull_request:
branches:
- 'master'
push:
branches:
- 'feature*'
- 'feature_*'
- 'feature/*'
- 'hotfix/*'
- 'hotfix*'
- 'master'
schedule:
- cron: '0 18 * * *'
env:
CUSTOM_DIR: 'darkwizard242.hadolint'
jobs:
code_quality:
name: SonarCloud Code Quality Check
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
path: '${{ env.CUSTOM_DIR }}'
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
projectBaseDir: '${{ env.CUSTOM_DIR }}'
args: >
-Dsonar.projectVersion=${{ github.ref }}_${{ github.run_number }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build & Test
runs-on: ubuntu-22.04
strategy:
max-parallel: 10
matrix:
IMAGE: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, rockylinux-8, debian-bullseye, debian-buster]
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
path: '${{ env.CUSTOM_DIR }}'
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Update repo cache, install python3-setuptools and required pip modules
run: |
sudo apt-get update
sudo apt-get install python3-setuptools -y
pip3 install -U -r $CUSTOM_DIR/requirements.txt
- name: Execute Molecule test of role for ${{ matrix.IMAGE }}
working-directory: '${{ env.CUSTOM_DIR }}'
run: DISTRO=${{ matrix.IMAGE }} molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'