Skip to content

Commit 37ec3ea

Browse files
committed
[actions] update CI to only run vagrant if role files are updated
1 parent b9a13c3 commit 37ec3ea

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ name: CI
55
pull_request: {}
66
push:
77
branches: ["main"]
8+
workflow_dispatch: {}
89

910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -18,23 +19,46 @@ permissions:
1819
contents: read
1920

2021
jobs:
22+
changes:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
role: ${{ steps.filter.outputs.role }}
26+
steps:
27+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
29+
id: filter
30+
with:
31+
base: ${{ github.ref }}
32+
filters: |
33+
role:
34+
- 'tasks/**'
35+
- 'handlers/**'
36+
- 'defaults/**'
37+
- 'vars/**'
38+
- 'files/**'
39+
- 'library/**'
40+
- 'module_utils/**'
41+
- 'Vagrantfile'
2142
vagrant-deploy:
43+
needs: ["changes"]
44+
if: ${{ needs.changes.outputs.role == 'true' || github.event_name == 'workflow_dispatch' }}
2245
runs-on: ubuntu-22.04
2346
steps:
2447
- uses: actions/checkout@v4
2548
- run: sudo apt install nfs-kernel-server
2649
- run: sudo pipx inject ansible-core jmespath netaddr
2750
- run: ansible-galaxy install geerlingguy.ntp
51+
# yamllint disable rule:line-length
2852
- name: setup vagrant
2953
run: |
3054
# Copyright The containerd Authors
31-
#
55+
#
3256
# Licensed under the Apache License, Version 2.0 (the "License");
3357
# you may not use this file except in compliance with the License.
3458
# You may obtain a copy of the License at
35-
#
59+
#
3660
# http://www.apache.org/licenses/LICENSE-2.0
37-
#
61+
#
3862
# Unless required by applicable law or agreed to in writing, software
3963
# distributed under the License is distributed on an "AS IS" BASIS,
4064
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,6 +74,7 @@ jobs:
5074
sudo apt-get build-dep -y vagrant ruby-libvirt
5175
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
5276
vagrant plugin install vagrant-libvirt
77+
# yamllint enable rule:line-length
5378
- run: >
5479
sudo -E -u ${USER}
5580
ANSIBLE_STDOUT_CALLBACK=debug

0 commit comments

Comments
 (0)