From 7c1e1fb96cbe6bffdc793a21e733fc91e6843986 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Mon, 9 Dec 2024 11:06:21 +0000 Subject: [PATCH] Composite action Signed-off-by: Dan Webb --- .github/actions/kitchen-test/action.yml | 28 +++++++++++++++ .github/workflows/ci.yml | 48 +++---------------------- 2 files changed, 33 insertions(+), 43 deletions(-) create mode 100644 .github/actions/kitchen-test/action.yml diff --git a/.github/actions/kitchen-test/action.yml b/.github/actions/kitchen-test/action.yml new file mode 100644 index 0000000..d15a45e --- /dev/null +++ b/.github/actions/kitchen-test/action.yml @@ -0,0 +1,28 @@ +name: 'Kitchen Test' +description: 'Runs Test Kitchen tests for a specific suite' + +inputs: + suite: + description: 'Test suite to run' + required: true + os: + description: 'OS to test against' + required: true + +runs: + using: composite + steps: + - name: Install VirtualBox + shell: bash + run: | + brew update + brew upgrade virtualbox + + - name: Install Chef + uses: actionshub/chef-install@3.0.1 + + - name: Kitchen Converge + uses: actionshub/test-kitchen@2.1.0 + with: + suite: ${{ inputs.suite }} + os: ${{ inputs.os }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64becf2..b313163 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,14 +29,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install VirtualBox - run: | - brew update - brew upgrade virtualbox - - name: Install Chef - uses: actionshub/chef-install@3.0.1 - - name: Kitchen Converge - uses: actionshub/test-kitchen@2.1.0 + - uses: ./.github/actions/kitchen-test with: suite: firewalld os: ${{ matrix.os }} @@ -54,14 +47,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install VirtualBox - run: | - brew update - brew upgrade virtualbox - - name: Install Chef - uses: actionshub/chef-install@3.0.1 - - name: Kitchen Converge - uses: actionshub/test-kitchen@2.1.0 + - uses: ./.github/actions/kitchen-test with: suite: iptables os: ${{ matrix.os }} @@ -78,17 +64,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Chef - uses: actionshub/chef-install@3.0.1 - - name: Install VirtualBox - run: | - brew update - brew upgrade virtualbox - - name: Kitchen Converge - uses: actionshub/test-kitchen@2.1.0 - env: - CHEF_LICENSE: accept-no-persist - KITCHEN_LOCAL_YAML: kitchen.dokken.yml + - uses: ./.github/actions/kitchen-test with: suite: ufw os: ${{ matrix.os }} @@ -105,14 +81,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Chef - uses: actionshub/chef-install@3.0.1 - - name: Install VirtualBox - run: | - brew update - brew upgrade virtualbox - - name: Kitchen Converge - uses: actionshub/test-kitchen@2.1.0 + - uses: ./.github/actions/kitchen-test with: suite: nftables os: ${{ matrix.os }} @@ -129,14 +98,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Chef - uses: actionshub/chef-install@3.0.1 - - name: Install VirtualBox - run: | - brew update - brew upgrade virtualbox - - name: Kitchen Converge - uses: actionshub/test-kitchen@2.1.0 + - uses: ./.github/actions/kitchen-test with: suite: firewalld-dbus os: ${{ matrix.os }}