Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MIRSG molecule-test #5

Merged
merged 12 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/add-issue-to-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One day Renovate will come back 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can only dream

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dreams do come true - I just reenabled it...

I put it on the shared calendar to reenable, but I still forgot...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was scared to re-enable it haha

with:
ansible-roles-config: ./meta/requirements.yml
pre-commit-config: ./.pre-commit-config.yaml
36 changes: 5 additions & 31 deletions .github/workflows/molecule-firewalld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 5 additions & 31 deletions .github/workflows/molecule-provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
30 changes: 30 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test with Molecule
on:
workflow_call:
inputs:
run_tags:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally people use run-tags rather than run_tags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed it now

required: false
type: string
default: all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required isn't required if a default is set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well spotted, I've removed it


jobs:
molecule:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
scenario:
- centos7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only centos7?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah for now, I'll add Rocky 9 in a separate pr

env:
MOLECULE_RUN_TAGS: ${{ inputs.run_tags }}
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1

steps:
- name: Run `molecule test`
uses: UCL-MIRSG/.github/actions/[email protected]
with:
scenario: ${{ matrix.scenario }}
checkout_path: ansible_collections/mirsg/infrastructure
tests_path: ansible_collections/mirsg/infrastructure/tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing new line at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think new line was there but it wasn't empty 😬

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, just saw the dreaded 🚫

Loading