@@ -3,6 +3,10 @@ name: Build MSYS2 package
33on :
44 workflow_call :
55 inputs :
6+ if :
7+ description : " Condition to run the workflow"
8+ type : boolean
9+ default : true
610 package_name :
711 description : " Package name to build"
812 type : string
3034 type : string
3135 default : " "
3236
33- defaults :
34- run :
35- shell : msys2 {0}
36-
3737env :
3838 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3939 FLAVOR : ${{ (inputs.runner_arch == 'aarch64') && (inputs.build_with_native && 'NATIVE_WITH_NATIVE' || 'NATIVE_WITH_CROSS') || 'CROSS' }}
4040 CLEAN_BUILD : 1
4141
4242jobs :
4343 build :
44- name : Build ${{ inputs.package_name }}
44+ name : ${{ inputs.if && ' Build' || 'Skip'}} ${{ inputs.package_name }}
4545 timeout-minutes : 720
4646 runs-on : >-
4747 ${{ fromJson(inputs.runner_arch == 'aarch64'
4848 && '["Windows", "ARM64", "MSYS2"]'
4949 || '["windows-latest"]') }}
5050
51+ defaults :
52+ run :
53+ shell : msys2 {0}
54+
5155 steps :
5256 - name : Kill hanging processes
53- if : inputs.runner_arch == 'aarch64'
57+ if : inputs.if && inputs. runner_arch == 'aarch64'
5458 shell : powershell
5559 run : |
5660 taskkill /F /FI 'MODULES eq msys-2.0.dll'
5963 exit 0
6064
6165 - uses : Windows-on-ARM-Experiments/setup-msys2@main
66+ if : inputs.if
6267 timeout-minutes : 10
6368 with :
6469 msystem : >-
@@ -70,83 +75,90 @@ jobs:
7075 cache : true
7176
7277 - name : Checkout repository
78+ if : inputs.if
7379 uses : actions/checkout@v4
7480
7581 - name : Checkout ${{ inputs.packages_repository }} repository
82+ if : inputs.if
7683 uses : actions/checkout@v4
7784 with :
7885 repository : ${{ inputs.packages_repository }}
79- ref : ${{ ((inputs.runner_arch == 'aarch64') && !inputs.build_with_native) && format('{0}-cross', inputs.packages_branch) || inputs.packages_branch }}
86+ ref : ${{ ((inputs.runner_arch == 'aarch64') && !inputs.build_with_native) && format('{0}-cross', inputs.packages_branch) || (( inputs.packages_repository == 'Windows-on-ARM-Experiments/MINGW-packages') && format('{0}-native-2', inputs. packages_branch) || inputs.packages_branch) }}
8087 sparse-checkout : ${{ inputs.package_name }}
8188 path : ${{ github.workspace }}/packages
8289
8390 - name : Setup packages repository
84- if : inputs.runner_arch == 'aarch64'
91+ if : inputs.if && inputs. runner_arch == 'aarch64'
8592 run : |
8693 `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh
8794
8895 - name : Install dependencies
96+ if : inputs.if
8997 run : >-
9098 `cygpath "${{ github.workspace }}"`/.github/scripts/install-dependencies.sh \
9199 "git mingw-w64-x86_64-github-cli mingw-w64-x86_64-jq ${{ inputs.dependencies }}"
92100
93101 - name : Download artifacts
94- if : inputs.needs
102+ if : inputs.if && inputs. needs
95103 run : |
96104 `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh \
97105 ${{ github.run_id }} \
98106 '${{ inputs.needs }}'
99107
100108 - name : Install artifacts
101- if : inputs.needs
109+ if : inputs.if && inputs. needs
102110 run : |
103111 `cygpath "${{ github.workspace }}"`/.github/scripts/install-artifacts.sh
104112
105113 - name : Copy missing headers for mingw-w64-cross-mingwarm64-crt
106- if : inputs.package_name == 'mingw-w64-cross-mingwarm64-crt'
114+ if : inputs.if && inputs. package_name == 'mingw-w64-cross-mingwarm64-crt'
107115 run : |
108116 `cygpath "${{ github.workspace }}"`/.github/scripts/pthread-headers-hack-before.sh
109117
110118 - name : Setup MINGWARM64 environment
111- if : inputs.runner_arch == 'aarch64'
119+ if : inputs.if && inputs. runner_arch == 'aarch64'
112120 run : |
113121 `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh
114122
115123 - name : Enable Ccache
124+ if : inputs.if
116125 id : enable-ccache
117126 run : |
118127 `cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh
119128
120129 - name : Restore Ccache
130+ if : inputs.if
121131 uses : actions/cache/restore@v4
122132 with :
123133 path : ${{ github.workspace }}/ccache
124134 key : ${{ inputs.package_name }}-ccache-${{ steps.enable-ccache.outputs.timestamp }}
125135 restore-keys : ${{ inputs.package_name }}-
126136
127137 - name : Build ${{ inputs.package_name }}
138+ if : inputs.if
128139 timeout-minutes : 720
129140 working-directory : ${{ github.workspace }}/packages/${{ inputs.package_name }}
130141 run : |
131142 `cygpath "${{ github.workspace }}"`/.github/scripts/build-package.sh \
132143 ${{ inputs.packages_repository }}
133144
134145 - name : Save Ccache
135- if : always()
146+ if : inputs.if && always()
136147 uses : actions/cache/save@v4
137148 with :
138149 path : ${{ github.workspace }}/ccache
139150 key : ${{ inputs.package_name }}-ccache-${{ steps.enable-ccache.outputs.timestamp }}
140151
141152 - name : Upload ${{ inputs.package_name }}
153+ if : inputs.if
142154 uses : actions/upload-artifact@v4
143155 with :
144156 name : ${{ inputs.package_name }}
145157 retention-days : 3
146158 path : ${{ github.workspace }}/packages/${{ inputs.package_name }}/*.pkg.tar.zst
147159
148160 - name : Upload build folder
149- if : failure()
161+ if : inputs.if && failure()
150162 uses : actions/upload-artifact@v4
151163 with :
152164 name : ${{ inputs.package_name }}-build
0 commit comments