-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (150 loc) · 4.53 KB
/
ci.yml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
name: CI
on:
pull_request:
branches:
- main
types:
- opened
- ready_for_review
- synchronize
- reopened
push:
branches:
- main
workflow_dispatch:
inputs:
debug:
type: choice
description: Debug mode
required: false
options:
- "true"
- "false"
# Allow one concurrent
concurrency:
group: ${{ format('{0}-{1}-{2}-{3}-{4}', github.workflow, github.event_name, github.ref, github.base_ref, github.head_ref) }}
cancel-in-progress: true
env:
DEBUG: ${{ inputs.debug || secrets.ACTIONS_RUNNER_DEBUG || vars.ACTIONS_RUNNER_DEBUG || secrets.ACTIONS_STEP_DEBUG || vars.ACTIONS_STEP_DEBUG || false }}
jobs:
dog-food:
name: Dog food
runs-on: ubuntu-latest
outputs:
repos: ${{ steps.get-repos.outputs.repos }}
count: ${{ steps.get-repos.outputs.count }}
format: ${{ steps.get-repos.outputs.format }}
steps:
- name: Debug
if: ${{ env.DEBUG == 'true' }}
uses: raven-actions/debug@v1
with:
vars-context: ${{ toJson(vars) }}
secrets-context: ${{ toJson(secrets) }}
needs-context: ${{ toJson(needs) }}
inputs-context: ${{ toJson(inputs) }}
- name: Checkout
uses: actions/checkout@v4
- name: Get GitHub Token
uses: wow-actions/use-app-token@v2
id: get-token
with:
app_id: ${{ secrets.ORG_BOT_APP_ID }}
private_key: ${{ secrets.ORG_BOT_PRIVATE_KEY }}
fallback: ${{ github.token }}
- name: Get Repositories Action (json)
id: get-repos
uses: ./
with:
github-token: ${{ steps.get-token.outputs.BOT_TOKEN }}
topics: "raven-actions,composite-action"
- name: Get Repositories Action (flat)
id: get-repos-flat
uses: ./
with:
github-token: ${{ steps.get-token.outputs.BOT_TOKEN }}
topics: "raven-actions,composite-action,debug"
format: flat
- name: Test flat output
run: |
echo "Total count: ${COUNT}"
echo "Format: ${FORMAT}"
echo "Repos:"
echo -e "${REPOS}"
env:
REPOS: ${{ steps.get-repos-flat.outputs.repos }}
COUNT: ${{ steps.get-repos-flat.outputs.count }}
FORMAT: ${{ steps.get-repos-flat.outputs.format }}
test-matrix:
name: Test matrix (${{ matrix.repo.name }})
if: ${{ needs.dog-food.outputs.repos != '[]' }}
runs-on: ubuntu-latest
needs:
- dog-food
strategy:
matrix:
repo: ${{ fromJson(needs.dog-food.outputs.repos) }}
max-parallel: 2
fail-fast: false
steps:
- name: Test
run: |
echo "Total count: ${COUNT}"
echo "Format: ${FORMAT}"
echo "Repo: ${REPO}"
env:
REPO: ${{ toJson(matrix.repo) }}
COUNT: ${{ needs.dog-food.outputs.count }}
FORMAT: ${{ needs.dog-food.outputs.format }}
dog-food-matrix:
name: Dog food (${{ matrix.os }})
needs:
- test-matrix
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get GitHub Token
uses: wow-actions/use-app-token@v2
id: get-token
with:
app_id: ${{ secrets.ORG_BOT_APP_ID }}
private_key: ${{ secrets.ORG_BOT_PRIVATE_KEY }}
fallback: ${{ github.token }}
- name: Get Repositories Action
id: get-repos
uses: ./
with:
github-token: ${{ steps.get-token.outputs.BOT_TOKEN }}
topics: "github-actions,actions"
operator: AND
- name: Test
if: ${{ runner.os != 'Windows' }}
run: |
echo "Total count: ${COUNT}"
echo "Format: ${FORMAT}"
echo "Repos: ${REPOS}"
shell: bash
env:
REPOS: ${{ toJson(steps.get-repos.outputs.repos) }}
COUNT: ${{ steps.get-repos.outputs.count }}
FORMAT: ${{ steps.get-repos.outputs.format }}
- name: Test
if: ${{ runner.os == 'Windows' }}
run: |
Write-Output "Total count: ${env:COUNT}"
Write-Output "Format: ${env:FORMAT}"
Write-Output "Repos: ${env:REPOS}"
shell: pwsh
env:
REPOS: ${{ toJson(steps.get-repos.outputs.repos) }}
COUNT: ${{ steps.get-repos.outputs.count }}
FORMAT: ${{ steps.get-repos.outputs.format }}