-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (85 loc) · 2.6 KB
/
ci.yaml
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
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
- name: Check go fmt
run: |
task check-format
- name: Check linting
run: |
task lint
build:
name: Build
needs: [lint]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
- name: Build Binary
run: |
task build-all
- uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: "[skip ci] Update compiled binaries"
file_pattern: "bin/*"
test:
name: Test
needs: [lint, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GHA_TOKEN }}
- name: Install Task
uses: arduino/setup-task@v1
- name: Generate test branch name
id: generate_branch
run: |
echo "branch=test/${{ github.head_ref }}/$(git rev-parse --short HEAD)/${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Generate tests
run: |
ACTION_VERSION=${{ github.head_ref }} task gen-tests
- name: Commit generated tests
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: "[skip ci] Update tests"
file_pattern: ".github/workflows/autogen-test.yaml"
branch: ${{ steps.generate_branch.outputs.branch }}
create_branch: true
- name: Trigger generated tests
uses: convictional/[email protected]
with:
owner: Y0sh1dk
repo: gha-docker-image-exists
github_token: ${{ secrets.GHA_TOKEN }}
workflow_file_name: autogen-test.yaml
ref: ${{ steps.generate_branch.outputs.branch }}
wait_workflow: true
- name: Delete branch
if: always()
run: |
echo "Deleting branch ${{ steps.generate_branch.outputs.branch }}..."
git push origin --delete ${{ steps.generate_branch.outputs.branch }}