Skip to content

Merge pull request #25 from negrutiu/feature/GH-21-vcpkg-caching2 #58

Merge pull request #25 from negrutiu/feature/GH-21-vcpkg-caching2

Merge pull request #25 from negrutiu/feature/GH-21-vcpkg-caching2 #58

Workflow file for this run

name: Build
on:
push:
branches:
- master
- 'feature/**'
- 'bugfix/**'
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
name: Build
outputs:
# accessible from other jobs as ${{needs.experiments.outputs.version}}
version: ${{steps.version.outputs.version}}
strategy:
matrix:
os: [windows-latest]
arch: [amd64, x86]
charset: [unicode]
include:
- os: windows-latest
arch: x86
charset: ansi
runs-on: ${{matrix.os}}
defaults:
run:
shell: cmd
steps:
- id: version
name: Version
shell: python
run: |
import os
from datetime import datetime, timezone
date = datetime.now(tz=timezone.utc)
with open(os.getenv('GITHUB_OUTPUT'), "a") as fout:
print( f"version={date.year}.{date.month}.{date.day}.${{github.run_number}}")
fout.write(f"version={date.year}.{date.month}.{date.day}.${{github.run_number}}")
- name: Upgrade msys2/mingw32
if: matrix.arch == 'x86'
uses: msys2/setup-msys2@v2
with:
msystem: mingw32
release: false
update: true
install: git mingw-w64-i686-toolchain
- name: Upgrade msys2/mingw64
if: matrix.arch == 'amd64'
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
release: false
update: true
install: mingw-w64-x86_64-toolchain
- name: Print environment
if: failure()
run: |
echo ----------------------------------------------------
set
echo ----------------------------------------------------
dir /OG %SystemDrive%\
echo ----------------------------------------------------
dir /s /b c:\msys64\*.exe
echo ----------------------------------------------------
echo -- 1 && %SystemDrive%\msys64\mingw32\bin\gcc.exe -v
echo -- 2 && %SystemDrive%\msys64\mingw64\bin\gcc.exe -v
echo -- 3 && %SystemDrive%\mingw32\bin\gcc.exe -v
echo -- 4 && %SystemDrive%\mingw64\bin\gcc.exe -v
echo -- 5 && gcc.exe -v
echo ====================================================
py -0p
echo ----------------------------------------------------
py -3 -V
py -3 -m pip list
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Patch version
working-directory: src/nscurl
run: py -3 _set_version.py --version=${{steps.version.outputs.version}}
- name: Checkout vcpkg
uses: actions/checkout@v4
with:
repository: 'Microsoft/vcpkg'
path: vcpkg/clone
- name: Setup vcpkg cache
uses: actions/cache@v4
with:
path: vcpkg/archives
key: ${{runner.os}}-${{matrix.arch}}-${{matrix.charset}}-${{hashFiles('vcpkg/overlay_*', 'vcpkg/clone/ports/curl', 'vcpkg/clone/ports/openssl', 'vcpkg/clone/ports/nghttp2', 'vcpkg/clone/ports/zlib', 'vcpkg/clone/ports/brotli', 'vcpkg/clone/ports/zstd')}}
- name: Build
run: _build.bat mingw release ${{matrix.arch}} ${{matrix.charset}}
- name: Print packages
run: dir /s /b /a-d packages
- name: Upload
uses: actions/upload-artifact@v4
with:
name: package-${{matrix.arch}}-${{matrix.charset}}
path: packages/Release-mingw-${{matrix.arch}}-${{matrix.charset}}/*
- name: Upload curl
if: matrix.charset == 'unicode'
uses: actions/upload-artifact@v4
with:
name: curl-${{matrix.arch}}
path: packages/Release-mingw-${{matrix.arch}}-curl/*
package:
name: Package
needs: build
runs-on: windows-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: package-*
merge-multiple: true
- name: Upload final package
uses: actions/upload-artifact@v4
with:
name: NScurl
path: artifacts/*
# Install an NSIS fork with amd64 support
# note: NSIS-negrutiu sits in C:\Program Files\NSIS
# note: NSIS-official sits in C:\Program Files (x86)\NSIS
- name: Install NSIS-negrutiu
shell: cmd
run: |
setlocal enabledelayedexpansion
set version=3.10.7422.0
set arch=amd64
curl -L --fail -o nsis-%version%-negrutiu-%arch%.exe https://github.com/negrutiu/nsis/releases/download/v%version%/nsis-%version%-negrutiu-%arch%.exe || exit /b !errorlevel!
echo installing...
nsis-%version%-negrutiu-%arch%.exe /S
- name: Build NSIS example (x86-unicode)
shell: cmd
run: |
set PATH=%ProgramFiles%\NSIS;%PATH%
makensis.exe /V4 /DPLUGIN_DIR=..\..\Plugins\x86-unicode artifacts\Examples\NScurl\NScurl-Test.nsi
- name: Build NSIS example (x86-ansi)
shell: cmd
run: |
set PATH=%ProgramFiles%\NSIS;%PATH%
makensis.exe /V4 /DPLUGIN_DIR=..\..\Plugins\x86-ansi /DANSI artifacts\Examples\NScurl\NScurl-Test.nsi
- name: Build NSIS example (amd64-unicode)
shell: cmd
run: |
set PATH=%ProgramFiles%\NSIS;%PATH%
makensis.exe /V4 /DPLUGIN_DIR=..\..\Plugins\amd64-unicode /DAMD64 artifacts\Examples\NScurl\NScurl-Test.nsi
- name: Upload NSIS examples
uses: actions/upload-artifact@v4
with:
name: NScurl-Tests
path: artifacts/Examples/NScurl/NScurl-Test-*.exe