From 37ec3ea0373e8d1866302e43078d0d81f5980e17 Mon Sep 17 00:00:00 2001 From: lae Date: Fri, 15 Nov 2024 06:53:53 +0900 Subject: [PATCH] [actions] update CI to only run vagrant if role files are updated --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 676ac10..09607c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ name: CI pull_request: {} push: branches: ["main"] + workflow_dispatch: {} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -18,23 +19,46 @@ permissions: contents: read jobs: + changes: + runs-on: ubuntu-latest + outputs: + role: ${{ steps.filter.outputs.role }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: filter + with: + base: ${{ github.ref }} + filters: | + role: + - 'tasks/**' + - 'handlers/**' + - 'defaults/**' + - 'vars/**' + - 'files/**' + - 'library/**' + - 'module_utils/**' + - 'Vagrantfile' vagrant-deploy: + needs: ["changes"] + if: ${{ needs.changes.outputs.role == 'true' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - run: sudo apt install nfs-kernel-server - run: sudo pipx inject ansible-core jmespath netaddr - run: ansible-galaxy install geerlingguy.ntp + # yamllint disable rule:line-length - name: setup vagrant run: | # Copyright The containerd Authors - # + # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at - # + # # http://www.apache.org/licenses/LICENSE-2.0 - # + # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -50,6 +74,7 @@ jobs: sudo apt-get build-dep -y vagrant ruby-libvirt sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev vagrant plugin install vagrant-libvirt + # yamllint enable rule:line-length - run: > sudo -E -u ${USER} ANSIBLE_STDOUT_CALLBACK=debug