From: Anil Belur Date: Mon, 8 Jan 2024 22:57:20 +0000 (+1000) Subject: CI: Add Github action workflow to test roles X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F72510%2F2;p=ansible%2Froles%2Fjava-install.git CI: Add Github action workflow to test roles - Ensure that the roles name matches what is in the path. - Make add repository resilient to runtime failures retries. Change-Id: Id6e5ee1ce411a862e17fc965d00d9653cafecdde Signed-off-by: Anil Belur --- diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml new file mode 100644 index 0000000..acac776 --- /dev/null +++ b/.github/workflows/CI.yaml @@ -0,0 +1,61 @@ +--- +name: CI Verify Ansible roles with molecule +"on": + pull_request: + push: + branches: + - master + schedule: + - cron: "0 7 * * 0" + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Set up Python 3. + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Install lint dependencies. + run: pip3 install yamllint + + - name: Lint code. + run: | + yamllint . + + molecule: + name: Molecule + runs-on: ubuntu-latest + strategy: + matrix: + distro: + - geerlingguy/docker-centos7-ansible:latest + - geerlingguy/docker-centos8-ansible:latest + - ubuntu1804 + - ubuntu2004 + - ubuntu2204 + fail-fast: false + + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Set up Python 3.x + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Install test dependencies. + run: pip3 install ansible ansible-lint molecule-plugins[docker] docker + + - name: Run Molecule tests. + run: molecule test + env: + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/tasks/Debian.yml b/tasks/Debian.yml index 097439b..094c606 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -11,6 +11,10 @@ apt_repository: repo: 'ppa:openjdk-r/ppa' become: true + register: task_result + until: task_result is success + retries: 3 + delay: 10 - name: Install OpenJDK 1.8.0, 11 and 12 apt: