From 57ba932270b59fe1454be58fc72bfba27e967abd Mon Sep 17 00:00:00 2001 From: JOHNMWASHUMA Date: Tue, 10 Sep 2024 12:20:59 +0300 Subject: [PATCH] Update ci workflow --- .github/workflows/main.yml | 87 +++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 899f0c0..53a62f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,30 +1,59 @@ --- -name: Molecule Test - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.6] - - steps: - - uses: actions/checkout@v1 - with: - path: "${{ github.repository }}" - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - sudo apt install docker - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Test with molecule - run: | - molecule test + name: Molecule Test + on: + push: + pull_request: + schedule: + - cron: "5 12 * * 1" + + jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + with: + path: "${{ github.repository }}" + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip3 install yamllint + + - name: Lint code + working-directory: onaio/ansible-express + run: yamllint . + molecule: + name: Molecule + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + distro: + - ubuntu2204 + - ubuntu2004 + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + with: + path: "${{ github.repository }}" + + - name: Set up Python 3. + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: pip3 install ansible molecule-plugins[docker] docker pytest-testinfra + + - name: Run Molecule tests. + working-directory: onaio/ansible-express + run: molecule test + env: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + MOLECULE_DISTRO: ${{ matrix.distro }}