diff --git a/.github/workflows/add-issue-to-project.yml b/.github/workflows/add-issue-to-project.yml index a6f326c9..9f7496d5 100644 --- a/.github/workflows/add-issue-to-project.yml +++ b/.github/workflows/add-issue-to-project.yml @@ -9,7 +9,7 @@ jobs: add-issue-to-project: runs-on: ubuntu-latest steps: - - uses: UCL-MIRSG/.github/actions/add-to-project@v0.36.0 + - uses: UCL-MIRSG/.github/actions/add-to-project@v0.38.0 with: app-id: ${{ secrets.APP_ID }} app-pem: ${{ secrets.APP_PEM }} diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 8ddaef63..cb44c915 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -11,7 +11,7 @@ jobs: linting: runs-on: ubuntu-latest steps: - - uses: UCL-MIRSG/.github/actions/linting@v0.36.0 + - uses: UCL-MIRSG/.github/actions/linting@v0.38.0 with: ansible-roles-config: ./meta/requirements.yml pre-commit-config: ./.pre-commit-config.yaml diff --git a/.github/workflows/molecule-firewalld.yml b/.github/workflows/molecule-firewalld.yml index 15ac044b..bfb9f68e 100644 --- a/.github/workflows/molecule-firewalld.yml +++ b/.github/workflows/molecule-firewalld.yml @@ -3,37 +3,11 @@ on: pull_request: paths: - "roles/firewalld/**" + - ".github/workflows/molecule.yml" + - ".github/workflows/molecule-firewalld.yml" jobs: molecule-firewalld: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - scenario: - - centos7 - env: - MOLECULE_RUN_TAGS: firewalld - PY_COLORS: 1 - ANSIBLE_FORCE_COLOR: 1 - steps: - - name: Check out the codebase - uses: actions/checkout@v4 - with: - path: ansible_collections/mirsg/infrastructure - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - - name: Install test dependencies - run: | - sudo apt-get update && sudo apt-get -y install rsync - python3 -m pip install --upgrade pip - python3 -m pip install ansible molecule molecule-plugins[docker] docker requests - - - name: Test with molecule - run: | - cd ansible_collections/mirsg/infrastructure/tests - molecule test --scenario-name "${{ matrix.scenario }}" + uses: ./.github/workflows/molecule.yml + with: + run-tags: firewalld diff --git a/.github/workflows/molecule-provision.yml b/.github/workflows/molecule-provision.yml index b9447b16..15827565 100644 --- a/.github/workflows/molecule-provision.yml +++ b/.github/workflows/molecule-provision.yml @@ -3,37 +3,11 @@ on: pull_request: paths: - "roles/provision/**" + - ".github/workflows/molecule.yml" + - ".github/workflows/molecule-provision.yml" jobs: molecule-provision: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - scenario: - - centos7 - env: - MOLECULE_RUN_TAGS: provision - PY_COLORS: 1 - ANSIBLE_FORCE_COLOR: 1 - steps: - - name: Check out the codebase - uses: actions/checkout@v4 - with: - path: ansible_collections/mirsg/infrastructure - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - - name: Install test dependencies - run: | - sudo apt-get update && sudo apt-get -y install rsync - python3 -m pip install --upgrade pip - python3 -m pip install ansible molecule molecule-plugins[docker] docker requests - - - name: Test with molecule - run: | - cd ansible_collections/mirsg/infrastructure/tests - molecule test --scenario-name "${{ matrix.scenario }}" + uses: ./.github/workflows/molecule.yml + with: + run-tags: provision diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml new file mode 100644 index 00000000..f510d4ca --- /dev/null +++ b/.github/workflows/molecule.yml @@ -0,0 +1,28 @@ +name: Test with Molecule +on: + workflow_call: + inputs: + run-tags: + type: string + default: all + +jobs: + molecule: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + scenario: + - centos7 + env: + MOLECULE_RUN_TAGS: ${{ inputs.run-tags }} + PY_COLORS: 1 + ANSIBLE_FORCE_COLOR: 1 + + steps: + - name: Run `molecule test` + uses: UCL-MIRSG/.github/actions/molecule-test@v0.38.0 + with: + scenario: ${{ matrix.scenario }} + checkout_path: ansible_collections/mirsg/infrastructure + tests_path: ansible_collections/mirsg/infrastructure/tests