|
1 | | -name: Build Kernel 2.0 |
| 1 | +name: Build Kernels |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | # schedule: |
@@ -30,39 +30,92 @@ jobs: |
30 | 30 | run: |
31 | 31 | shell: bash |
32 | 32 | steps: |
33 | | - - name: "PRE-BUILD CHECKS" |
| 33 | + - name: "✔️ Pre-build checks" |
34 | 34 | id: prebuild-checks |
35 | 35 | run: | |
36 | | - echo "cancel=false" >> $GITHUB_OUTPUT |
| 36 | + body="$(pwd)/body.txt" |
| 37 | + jsonFile="/home/runner/kernels.json" |
| 38 | + WSL_DATE="$( wget -qO- https://api.github.com/repos/microsoft/WSL2-Linux-Kernel/commits | jq '.[1].commit.committer.date' -r )" |
| 39 | + LAST_DATE="$( wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq .published_at -r )" || LAST_DATE="2000.01.01T00:00:00Z" |
| 40 | + echo "The last WSL2 Kernel commit date is: $WSL_DATE" |
| 41 | + echo "The last Release in this repo was on: $LAST_DATE" |
| 42 | + if [[ $WSL_DATE > $LAST_DATE ]]; then |
| 43 | + echo "NEW KERNEL SOURCE!!!!" |
| 44 | + echo "# KERNEL UPDATES" > $body |
| 45 | + echo >> $body |
| 46 | + wget -qO- https://api.github.com/repos/microsoft/WSL2-Linux-Kernel/releases/latest | jq .body -r >> $body |
| 47 | + fi |
| 48 | + if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then |
| 49 | + echo "NEW IMPROVEMENT!!!!" |
| 50 | + [ -f $body ] && echo >> $body |
| 51 | + echo "# IMPROVEMENTS" >> $body |
| 52 | + echo >> $body |
| 53 | + fi |
| 54 | + if [ -f $body ]; then |
| 55 | + echo "{}" | jq "\ |
| 56 | + .commitDate |= \"${WSL_DATE}\" |\ |
| 57 | + .buildDate |= \"$(TZ=UTC date +'%Y.%m.%dT%H:%M:%SZ')\"" > $jsonFile |
| 58 | + echo "cancel=false" >> $GITHUB_OUTPUT |
| 59 | + else |
| 60 | + echo "NOTHING NEW. CANCELLING ACTION..." |
| 61 | + echo "cancel=true" >> $GITHUB_OUTPUT |
| 62 | + fi |
37 | 63 |
|
38 | | -
|
39 | | - - name: "⏬ Checkout repository" |
| 64 | + - name: "⏬ Download repository" |
40 | 65 | if: ${{ steps.prebuild-checks.outputs.cancel }} != 'true' |
41 | 66 | uses: actions/checkout@v3 |
42 | 67 |
|
| 68 | + - name: "⏬ Download and Install Toolchain" |
| 69 | + if: ${{ steps.prebuild-checks.outputs.cancel }} != 'true' |
| 70 | + run: sudo apt -y install build-essential flex bison dwarves libssl-dev libelf-dev python3 bc jq aria2 p7zip-full |
| 71 | + |
| 72 | + - name: "⏬ Fetch latest WSL kernel source" |
| 73 | + if: ${{ steps.prebuild-checks.outputs.cancel }} != 'true' |
| 74 | + run: git clone --depth=1 https://github.com/microsoft/WSL2-Linux-Kernel.git kernel |
43 | 75 |
|
44 | | - - name: "DETECT CONFIGS" |
| 76 | + - name: "🔍 Detect Configurations" |
45 | 77 | id: set-matrix |
46 | 78 | if: ${{ steps.prebuild-checks.outputs.cancel }} != 'true' |
47 | 79 | shell: pwsh |
48 | 80 | run: | |
49 | 81 | $m=@{include = @()} |
50 | 82 | (gci *.dif).baseName | % { $m.include+=@{config = $_} } |
51 | | - "MATRIX:" |
52 | | - $m | ConvertTo-Json |
53 | | - "MATRIX STRING:" |
54 | | - "matrix=$(($m | ConvertTo-Json -compress) -replace '"','`"')" |
55 | 83 | "matrix=$(($m | ConvertTo-Json -compress) -replace '"','`"')" >> $env:GITHUB_OUTPUT |
56 | 84 |
|
| 85 | + - name: "📨 Send repo to jobs" |
| 86 | + uses: actions/cache@v3.2.6 |
| 87 | + id: cache-sources |
| 88 | + with: |
| 89 | + path: ./* |
| 90 | + key: ${{ github.sha }}-repo |
57 | 91 |
|
58 | | - - name: "✔️ TEST matrix" |
59 | | - if: ${{ steps.prebuild-checks.outputs.cancel }} != 'true' |
| 92 | + - name: "📨 Send release body" |
| 93 | + uses: actions/cache@v3.2.6 |
| 94 | + id: cache-sources |
| 95 | + with: |
| 96 | + path: ./body.txt |
| 97 | + key: ${{ github.sha }}-body |
| 98 | + |
| 99 | + - name: "🔧 Prepare debug session" |
| 100 | + if: github.event.inputs.debug_enabled == 'true' |
60 | 101 | run: | |
61 | | - echo "MATRIX:" |
62 | | - echo ${{ steps.set-matrix.outputs.matrix }} |
63 | | - echo "CANCEL:" |
64 | | - echo ${{ steps.prebuild-checks.outputs.cancel }} |
| 102 | + sudo apt -y install zsh zsh-syntax-highlighting |
| 103 | + sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh |
| 104 | + sudo chmod +x /usr/local/bin/oh-my-posh |
| 105 | + wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/.nanorc -O ~/.nanorc |
| 106 | + wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/profile.sh -O ~/profile.sh |
| 107 | + cp /etc/bash.bashrc ~ |
| 108 | + cat ~/profile.sh >> ~/bash.bashrc |
| 109 | + sudo cp ~/bash.bashrc /etc/bash.bashrc -f |
| 110 | + cp ~/profile.sh ~/.zshrc |
65 | 111 |
|
| 112 | + - name: "🐞 Debug session" |
| 113 | + uses: mxschmitt/action-tmate@v3 |
| 114 | + if: github.event.inputs.debug_enabled == 'true' |
| 115 | + env: |
| 116 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 117 | + ## More info at https://til.simonwillison.net/github-actions/debug-tmate |
| 118 | + ## or https://github.com/mxschmitt/action-tmate |
66 | 119 |
|
67 | 120 | ## BUILD ############################################################################## |
68 | 121 | job-build: |
|
0 commit comments