|
4 | 4 | pull_request: |
5 | 5 | branches: |
6 | 6 | - "main" |
| 7 | + pull_request_target: |
| 8 | + types: [labeled, reopened] |
| 9 | + branches: |
| 10 | + - "main" |
7 | 11 | workflow_dispatch: |
8 | | - |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
9 | 20 | jobs: |
10 | 21 | Spec: |
| 22 | + if: github.event_name != 'pull_request_target' |
11 | 23 | uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" |
12 | | - with: |
13 | | - runs_on: "ubuntu-24.04" |
14 | 24 | secrets: "inherit" |
15 | 25 |
|
16 | | - setup_matrix: |
17 | | - name: "Setup Test Matrix" |
18 | | - needs: "Spec" |
19 | | - runs-on: ubuntu-24.04 |
20 | | - outputs: |
21 | | - matrix: ${{ steps.get-matrix.outputs.matrix }} |
22 | | - |
23 | | - steps: |
24 | | - - name: Checkout Source |
25 | | - uses: actions/checkout@v3 |
26 | | - |
27 | | - - name: Activate Ruby 3.1 |
28 | | - uses: ruby/setup-ruby@v1 |
29 | | - with: |
30 | | - ruby-version: "3.1" |
31 | | - bundler-cache: true |
32 | | - |
33 | | - - name: Print bundle environment |
34 | | - run: | |
35 | | - echo ::group::bundler environment |
36 | | - bundle env |
37 | | - echo ::endgroup:: |
38 | | -
|
39 | | - - name: Setup Acceptance Test Matrix |
40 | | - id: get-matrix |
41 | | - run: | |
42 | | - bundle exec matrix_from_metadata_v2 --exclude-platforms '["Debian-12-arm", "Ubuntu-22.04-arm", "RedHat-9-arm"]' |
43 | | -
|
44 | 26 | Acceptance: |
45 | | - name: "${{matrix.platforms.label}}, ${{matrix.collection}}" |
46 | | - needs: |
47 | | - - setup_matrix |
48 | | - if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} |
49 | | - |
50 | | - runs-on: ubuntu-24.04 |
51 | | - strategy: |
52 | | - fail-fast: false |
53 | | - matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} |
54 | | - |
55 | | - env: |
56 | | - PUPPET_GEM_VERSION: '~> 7.24' |
57 | | - FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' |
58 | | - |
59 | | - steps: |
60 | | - - name: "Install Twingate" |
61 | | - uses: "twingate/github-action@v1" |
62 | | - with: |
63 | | - service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }} |
64 | | - |
65 | | - - name: Checkout Source |
66 | | - uses: actions/checkout@v3 |
67 | | - |
68 | | - - name: Activate Ruby 3.1 |
69 | | - uses: ruby/setup-ruby@v1 |
70 | | - with: |
71 | | - ruby-version: "3.1" |
72 | | - bundler-cache: true |
73 | | - |
74 | | - - name: Print bundle environment |
75 | | - run: | |
76 | | - bundle env |
77 | | -
|
78 | | - - name: "Disable mysqld apparmor profile" |
79 | | - if: ${{matrix.platforms.provider == 'docker'}} |
80 | | - run: | |
81 | | - sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ |
82 | | - sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld |
83 | | - sudo systemctl disable apparmor |
84 | | - sudo systemctl stop apparmor |
85 | | -
|
86 | | - - name: Provision test environment |
87 | | - run: | |
88 | | - bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' |
89 | | - FILE='spec/fixtures/litmus_inventory.yaml' |
90 | | - sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true |
91 | | -
|
92 | | - - name: Install agent |
93 | | - run: | |
94 | | - bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' |
95 | | -
|
96 | | - - name: Install module |
97 | | - run: | |
98 | | - bundle exec rake 'litmus:install_module' |
99 | | -
|
100 | | - - name: Run acceptance tests |
101 | | - run: | |
102 | | - bundle exec rake 'litmus:acceptance:parallel' |
103 | | -
|
104 | | - - name: Remove test environment |
105 | | - if: ${{ always() }} |
106 | | - continue-on-error: true |
107 | | - run: | |
108 | | - bundle exec rake 'litmus:tear_down' |
| 27 | + if: >- |
| 28 | + github.event_name == 'workflow_dispatch' || |
| 29 | + (github.event_name == 'pull_request' && |
| 30 | + github.event.pull_request.head.repo.fork == false) || |
| 31 | + (github.event_name == 'pull_request_target' && |
| 32 | + github.event.pull_request.head.repo.fork == true && |
| 33 | + contains(github.event.pull_request.labels.*.name, 'allowed-for-ci')) |
| 34 | + uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" |
| 35 | + with: |
| 36 | + flags: "--nightly --platform-exclude centos-7 --platform-exclude scientific-7 --platform-exclude oraclelinux-7 --platform-exclude almalinux-8 --arch-exclude arm" |
| 37 | + secrets: "inherit" |
0 commit comments