Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 62 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: cppfw/myci
ref: latest
ref: main
path: myci
- name: add myci to PATH
uses: myci-actions/export-env-var-powershell@main
Expand All @@ -122,6 +122,20 @@ jobs:
run: |
cd build/vcpkg/test
./${{ matrix.config }}/test.exe
- name: deploy vcpkg port
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.arch == 'x64' && matrix.config == 'Release' }}
shell: bash
run: |
# disable autocrlf for the vcpkg-repo clone (the default on windows runners
# would convert LF files to CRLF, which the vcpkg manifest checker rejects)
git config --global core.autocrlf false
# the deploy script invokes vcpkg directly, so add its root to PATH
export PATH="$VCPKG_ROOT:$PATH"
# bash is needed explicitly here (not just shell: bash):
# Git for Windows does not preserve the executable bit on checkout
# (core.filemode=false), so the script must be invoked via 'bash <script>'
# rather than executed directly; the step also overrides the PowerShell default shell.
bash myci/src/bash/myci-deploy-vcpkg.sh --repo cppfw/vcpkg-repo --port-dir build/vcpkg/overlay/${{ env.PACKAGE_NAME }}
Comment thread
igagis marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bash is needed explicitly here for two reasons:

  1. The step's shell defaults to PowerShell (defaults.run.shell: powershell). The step must override it (shell: bash), because the script is a POSIX-style shell script, not a PowerShell script — PowerShell's parser doesn't understand export PATH=..., # comments, or the POSIX ls/cp/rm-style invocations.
  2. shell: bash alone is not enough. Git for Windows does not preserve the executable bit on checkout (core.filemode=false), so ./myci/src/bash/myci-deploy-vcpkg.sh won't run — it lacks the +x. Invoking via bash <script> makes bash interpret the file as a script regardless of its permissions.

The same applies to the .sh GIT_ASKPASS helper — it's spawned via its #!/bin/bash shebang through bash, not as a bare executable.

- name: upload vcpkg logs to artifacts
if: always() # even if previous steps fail, this one needs to be run
uses: actions/upload-artifact@v4
Expand All @@ -133,10 +147,51 @@ jobs:
vcpkg-installation/buildtrees/*/*.txt
build/vcpkg/**/*.log
if-no-files-found: warn
- name: deploy vcpkg port
shell: bash
##### vcpkg-msys2 #####
# build the vcpkg port from an msys2 (MSYS) job using a fresh upstream vcpkg,
# because the vcpkg bundled with the windows runners is too old to handle the
# published vcpkg registry
vcpkg-msys2:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
name: vcpkg - msys2
steps:
- name: make msys2 to provide the default shell
uses: msys2/setup-msys2@v2
with:
update: true
msystem: MSYS
install: >-
git
jq
curl
zip
tar
- name: git clone
uses: myci-actions/checkout@main
- name: get myci scripts
uses: actions/checkout@v4
with:
repository: cppfw/myci
ref: main
path: myci
- name: add myci to PATH
uses: myci-actions/export-env-var@main
with: {name: PATH, value: "$PATH:$(pwd)/myci/src/bash"}
- name: install vcpkg
# bootstrap the windows vcpkg (not the msys2 one): the bundled/bootstrapped
# msys bootstrap is not needed here and the windows bootstrap is the reliable path
run: |
export PATH="$(pwd)/myci/src/bash:${VCPKG_ROOT}:${PATH}"
myci-deploy-vcpkg.sh --repo cppfw/vcpkg-repo --port-dir build/vcpkg/overlay/${PACKAGE_NAME}
# the port is deployed once per release, from a single matrix leg
if: ${{ matrix.arch == 'x64' && matrix.config == 'Release' && startsWith(github.ref, 'refs/tags/') }}
git clone https://github.com/microsoft/vcpkg.git vcpkg-fresh
powershell.exe vcpkg-fresh/scripts/bootstrap.ps1
- name: set VCPKG_ROOT
uses: myci-actions/export-env-var@main
with: {name: VCPKG_ROOT, value: "$(pwd)/vcpkg-fresh"}
- name: add VCPKG_ROOT to PATH
uses: myci-actions/export-env-var@main
with: {name: PATH, value: "$PATH:$VCPKG_ROOT"}
- name: prepare vcpkg port
shell: bash
run: myci-vcpkg-prepare.sh --git-ref ${{ github.sha }}
4 changes: 2 additions & 2 deletions build/vcpkg/test/vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "9b5cb8e554487f3edb5d50b80188883846f81e14",
"baseline": "ed403b337098c6dab8fbdf4dfdba9ec89612eb27",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "git",
"repository": "https://github.com/cppfw/vcpkg-repo/",
"baseline": "9fda5016dcd22857de5dd20702428ac8d1652a99",
"baseline": "8bfce7f037fe110e0cb69aa09aa257847895a7ea",
"reference": "main",
"packages": [
"myci",
Expand Down
Loading