Skip to content

Commit 825b347

Browse files
authored
Merge pull request #2107 from Adirio/split-GH-workflows
🌱 Split GH Actions jobs into separate workflows
2 parents 2d0bae4 + f5d2f6a commit 825b347

File tree

4 files changed

+139
-108
lines changed

4 files changed

+139
-108
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint
2+
3+
# Trigger the workflow on pull requests and direct pushes to any branch
4+
on:
5+
push:
6+
pull_request:
7+
8+
jobs:
9+
10+
lint:
11+
name: golangci-lint
12+
runs-on: ubuntu-latest
13+
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
14+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
15+
steps:
16+
- name: Clone the code
17+
uses: actions/checkout@v2
18+
- name: Run linter
19+
uses: golangci/golangci-lint-action@v2
20+
with:
21+
version: v1.37 # Always uses the latest patch version.
22+
only-new-issues: true # Show only new issues if it's a pull request
23+
- name: Report failure
24+
uses: nashmaniac/[email protected]
25+
# Only report failures of pushes (PRs have are visible through the Checks section) to the default branch
26+
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master'
27+
with:
28+
title: 🐛 Lint failed for ${{ github.sha }}
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
labels: kind/bug
31+
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/testdata.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Testdata verification
2+
3+
# Trigger the workflow on pull requests and direct pushes to any branch
4+
on:
5+
push:
6+
pull_request:
7+
8+
jobs:
9+
10+
testdata:
11+
name: Verify testdata directory
12+
runs-on: ubuntu-latest
13+
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
14+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
15+
steps:
16+
- name: Clone the code
17+
uses: actions/checkout@v2
18+
- name: Setup Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: '1.15'
22+
- name: Remove pre-installed kustomize
23+
# This step is needed as the following one tries to remove
24+
# kustomize for each test but has no permission to do so
25+
run: sudo rm -f /usr/local/bin/kustomize
26+
- name: Verify testdata directory
27+
run: make check-testdata
28+
- name: Report failure
29+
uses: nashmaniac/[email protected]
30+
# Only report failures of pushes (PRs have are visible through the Checks section) to the default branch
31+
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master'
32+
with:
33+
title: 🐛 Testadata verification failed for ${{ github.sha }}
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
labels: kind/bug
36+
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/unit-tests.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Unit tests
2+
3+
# Trigger the workflow on pull requests and direct pushes to any branch
4+
on:
5+
push:
6+
pull_request:
7+
8+
9+
jobs:
10+
11+
test:
12+
name: ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os:
17+
- ubuntu-latest
18+
- macos-latest
19+
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
20+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
21+
steps:
22+
- name: Clone the code
23+
uses: actions/checkout@v2
24+
- name: Setup Go
25+
uses: actions/setup-go@v2
26+
with:
27+
go-version: '1.15'
28+
# This step is needed as the following one tries to remove
29+
# kustomize for each test but has no permission to do so
30+
- name: Remove pre-installed kustomize
31+
run: sudo rm -f /usr/local/bin/kustomize
32+
- name: Perform the test
33+
run: make test
34+
- name: Report failure
35+
uses: nashmaniac/[email protected]
36+
# Only report failures of pushes (PRs have are visible through the Checks section) to the default branch
37+
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master'
38+
with:
39+
title: 🐛 Unit tests failed on ${{ matrix.os }} for ${{ github.sha }}
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
labels: kind/bug
42+
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
43+
44+
coverage:
45+
name: Code coverage
46+
needs:
47+
- test
48+
runs-on: ubuntu-latest
49+
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
50+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
51+
steps:
52+
- name: Clone the code
53+
uses: actions/checkout@v2
54+
- name: Setup Go
55+
uses: actions/setup-go@v2
56+
with:
57+
go-version: '1.15'
58+
- name: Generate the coverage output
59+
run: make test-coverage
60+
- name: Send the coverage output
61+
uses: shogo82148/actions-goveralls@v1
62+
with:
63+
path-to-profile: coverage-all.out
64+
- name: Report failure
65+
uses: nashmaniac/[email protected]
66+
# Only report failures of pushes (PRs have are visible through the Checks section) to the default branch
67+
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master'
68+
with:
69+
title: 🐛 Coverage report failed for ${{ github.sha }}
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
labels: kind/bug
72+
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 commit comments

Comments
 (0)