-
Notifications
You must be signed in to change notification settings - Fork 112
129 lines (128 loc) · 5.13 KB
/
pull_requests.yaml
File metadata and controls
129 lines (128 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Pull Request Checks
on:
pull_request:
branches:
- "**"
# Cancel old workflows whenever a PR is updated.
# Thanks to https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: nix develop --impure --command bash {0}
jobs:
changes:
runs-on: ubuntu-22.04
outputs:
charts-connectors: ${{ steps.chart-changes.outputs.charts-connectors }}
charts-connect: ${{ steps.chart-changes.outputs.charts-connect }}
charts-kminion: ${{ steps.chart-changes.outputs.charts-kminion }}
go-code: ${{ steps.chart-changes.outputs.go-code }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: chart-changes
with:
# NOTE: changes to "auxiliary" files such as Taskfile.yaml and
# flake.nix won't trigger actions besides lint. This is intentional
# due to the long run times of chart-testing. It's possible to
# accidentally # break the other chart workflows right now. Please
# ensure that you exercise changes to those files manually.
filters: |
charts-connectors:
- '.github/workflows/test_connectors.yaml'
- 'charts/connectors/ci/*'
- 'charts/connectors/files/*'
- 'charts/connectors/templates/**'
- 'charts/connectors/(.helmignore|values.schema.json|Chart.yaml|values.yaml)'
charts-kminion:
- '.github/workflows/test_kminion.yaml'
- 'charts/kminion/ci/*'
- 'charts/kminion/files/*'
- 'charts/kminion/templates/**'
- 'charts/kminion/(.helmignore|values.schema.json|Chart.yaml|values.yaml)'
charts-connect:
- 'charts/connect/ci/*'
- 'charts/connect/files/*'
- 'charts/connect/templates/**'
- 'charts/connect/(.helmignore|values.schema.json|Chart.yaml|values.yaml)'
go-code:
- '.github/workflows/pull_requests.yaml'
- '**/testdata/**'
- '**.go'
- 'go.mod'
- 'go.sum'
- 'charts/*/Chart.yaml'
lint:
runs-on: ubuntu-22.04
steps:
- uses: nixbuild/nix-quick-install-action@v34
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
# Cache the nix store.
- uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}
- uses: actions/checkout@v6
- run: task ci:lint
test-go:
needs: [changes, lint]
if: ${{ needs.changes.outputs.go-code == 'true' }}
runs-on: ubuntu-22.04
steps:
- uses: nixbuild/nix-quick-install-action@v34
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}
- uses: actions/checkout@v6
- run: go test ./... -short
test-charts-connectors:
needs: [changes, lint]
if: ${{ needs.changes.outputs.charts-connectors == 'true' }}
uses: ./.github/workflows/test_connectors.yaml
secrets: inherit
test-charts-kminion:
needs: [changes, lint]
if: ${{ needs.changes.outputs.charts-kminion == 'true' }}
uses: ./.github/workflows/test_kminion.yaml
secrets: inherit
test-charts-connect:
needs: [changes, lint]
if: ${{ needs.changes.outputs.charts-connect == 'true' }}
uses: ./.github/workflows/test_connect.yaml
secrets: inherit
summary:
if: always()
needs:
- lint
- test-charts-connectors
- test-charts-connect
- test-charts-kminion
- test-go
runs-on: ubuntu-22.04
steps:
- name: Summarize the results of the test matrix pass/fail
uses: re-actors/alls-green@release/v1
with:
allowed-skips: test-go, test-charts-connectors, test-charts-kminion, test-charts-connect
jobs: ${{ toJSON(needs)}}