-
Notifications
You must be signed in to change notification settings - Fork 1
202 lines (171 loc) · 5.71 KB
/
Matrix XP.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: WF Test
on:
workflow_dispatch:
inputs:
debug_enabled:
description: 'Debug session enabled'
required: false
default: false
type: boolean
## CONFIG ##############################################################################
jobs:
job-config:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
cancel: ${{ steps.prebuild-checks.outputs.cancel }}
defaults:
run:
shell: bash
steps:
- name: "PRE-BUILD CHECKS"
id: prebuild-checks
run: |
echo "cancel=false" >> $GITHUB_OUTPUT
- name: "✔️ ls"
run: |
pwd
ls -als $(pwd)
ls -als ~
- name: "⏬ Checkout repository"
if: steps.prebuild-checks.outputs.cancel != 'true'
uses: actions/checkout@v3
- name: "DETECT CONFIGS"
id: set-matrix
if: steps.prebuild-checks.outputs.cancel != 'true'
shell: pwsh
run: |
$m=@{include = @()}
(gci *.dif).baseName | % { $m.include+=@{config = $_} }
"MATRIX:"
$m | ConvertTo-Json
"MATRIX STRING:"
"matrix=$(($m | ConvertTo-Json -compress) -replace '"','`"')"
"matrix=$(($m | ConvertTo-Json -compress) -replace '"','`"')" >> $env:GITHUB_OUTPUT
- name: "✔️ TEST matrix"
if: steps.prebuild-checks.outputs.cancel != 'true'
run: |
echo "MATRIX:"
echo ${{ steps.set-matrix.outputs.matrix }}
echo "CANCEL:"
echo ${{ steps.prebuild-checks.outputs.cancel }}
- name: Set Cache
uses: actions/[email protected]
id: cache-sources
with:
path: ./*
key: ${{ github.sha }}-repo
## BUILD ##############################################################################
job-build:
needs: [ job-config ]
if: needs.job-config.outputs.cancel != 'true'
name: "Build configuration ${{ matrix.config }}"
runs-on: ubuntu-latest
strategy:
matrix: ${{ FromJson(needs.job-config.outputs.matrix) }}
# config: ${{ FromJson(needs.job-config.outputs.configs) }}
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: "✔️ ls"
run: |
pwd
ls -als $(pwd)
ls -als ~
- name: Hit Cache
uses: actions/[email protected]
id: cache-sources
with:
key: ${{ github.sha }}-repo
path: ./*
- name: "✔️ ls"
run: |
pwd
ls -als $(pwd)
ls -als ~
- name: "✔️ TEST matrix"
run: |
echo "MATRIX:"
echo ${{ needs.job-config.outputs.matrix }}
echo "CONFIG:"
echo ${{ matrix.config }}
echo "CANCEL:"
echo ${{ needs.job-config.outputs.cancel }}
echo "${{ matrix.config }}" >> WSL2kernel-${{ matrix.config }}
- name: "👍 Upload Artifact"
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config }}
path: |
WSL2kernel-${{ matrix.config }}
- name: Set Cache
uses: actions/[email protected]
id: cache-image
with:
key: ${{ github.sha }}-${{ matrix.config }}
path: ./WSL2kernel-${{ matrix.config }}
## PUBLISH ##############################################################################
job-publish:
if: needs.job-config.outputs.cancel != 'true'
needs:
- job-config
- job-build
name: "Publish"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: "✔️ TEST matrix"
run: |
echo "MATRIX:"
echo '${{ needs.job-config.outputs.matrix }}'
echo '${{ needs.job-config.outputs.matrix }}' | jq . || true
echo "CANCEL:"
echo needs.job-config.outputs.cancel
- name: Artifact downloader
uses: actions/download-artifact@v3
with:
path: ./artifacts
- uses: geekyeggo/delete-artifact@v2
with:
name: '*'
- name: "✔️ list Caches"
run: |
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/$GITHUB_REPOSITORY/actions/caches
- name: "🔧 Prepare debug session"
if: github.event.inputs.debug_enabled == 'true'
run: |
sudo apt install zsh zsh-syntax-highlighting
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh
wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/.nanorc -O ~/.nanorc
wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/profile.sh -O ~/.zshrc
cp /etc/bash.bashrc ~
cat ~/.zshrc >> ~/bash.bashrc
sudo cp ~/bash.bashrc /etc/bash.bashrc -f
- name: "🐞 Debug session"
uses: mxschmitt/action-tmate@v3
if: github.event.inputs.debug_enabled == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## More info at https://til.simonwillison.net/github-actions/debug-tmate
## or https://github.com/mxschmitt/action-tmate
- uses: snnaplab/delete-branch-cache-action@v1
- name: "✔️ list Caches"
run: |
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/$GITHUB_REPOSITORY/actions/caches
- name: "✔️ ls"
run: |
pwd
ls -als $(pwd)
ls -als ~
ls -Rals ~/artifacts