Switch to building with GitHub Actions #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/build* | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- "**" | |
paths: | |
- .github/workflows/build* | |
workflow_dispatch: | |
jobs: | |
build-exe: | |
name: Build ${{ matrix.link }} ${{ matrix.bits}} bits | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
bits: | |
- 32 | |
- 64 | |
link: | |
- shared | |
- static | |
env: | |
CLDR_VERSION: 45 | |
ICONV_VERSION: 1.17 | |
GETTEXT_VERSION: 0.22.5 | |
CYGWIN_NOWINPATH: 1 | |
CHERE_INVOKING: 1 | |
defaults: | |
run: | |
shell: C:\cygwin\bin\bash.exe --login -e {0} | |
steps: | |
- | |
name: Configure git | |
shell: cmd | |
run: git config --global core.autocrlf input | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Restore cache | |
id: restore-cache | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ matrix.link }}-${{ matrix.bits }} | |
path: | | |
C:\cygwin-packages | |
C:\cygwin\src\downloads | |
- | |
name: Setup | |
id: setup | |
shell: pwsh | |
run: ./.github/workflows/build-exe-setup.ps1 ${{ matrix.bits }} ${{ matrix.link }} | |
- | |
name: Download Cygwin installer | |
shell: pwsh | |
run: Invoke-WebRequest -Uri https://cygwin.com/setup-x86_64.exe -OutFile C:\CygwinInstaller.exe | |
- | |
name: Install Cygwin | |
shell: cmd | |
run: > | |
C:\CygwinInstaller.exe | |
--root C:\cygwin | |
--local-package-dir C:\cygwin-packages | |
--packages ${{ steps.setup.outputs.cygwin-packages }} | |
--site http://mirrors.kernel.org/sourceware/cygwin/ | |
--only-site | |
--quiet-mode | |
--upgrade-also | |
--no-shortcuts | |
- | |
name: Setup Cygwin environment | |
id: setup-cygwin | |
working-directory: C:\cygwin | |
run: >- | |
printf '\nPATH=${{ steps.setup.outputs.cygwin-path }}\nexport PATH\n' >>$HOME/.bash_profile | |
&& mkdir -p "$HOME" | |
&& mkdir -p /src/downloads | |
&& mkdir -p /installed | |
&& mkdir -p /output | |
- | |
name: Download CLDR | |
working-directory: C:\cygwin\src\downloads | |
shell: pwsh | |
run: | | |
if (Test-Path -LiteralPath "cldr-$env:CLDR_VERSION.zip" -PathType Leaf) { | |
Write-Host -Object 'Already downloaded' | |
} else { | |
Invoke-WebRequest "https://unicode.org/Public/cldr/$env:CLDR_VERSION/core.zip" -OutFile "cldr-$env:CLDR_VERSION.zip" | |
Write-Host -Object 'Downloaded' | |
} | |
- | |
name: Extract CLDR | |
working-directory: C:\cygwin\installed | |
run: >- | |
true | |
&& unzip -p /src/downloads/cldr-$CLDR_VERSION.zip LICENSE >cldr-license.txt | |
&& unzip -p /src/downloads/cldr-$CLDR_VERSION.zip common/supplemental/plurals.xml >cldr-plurals.xml | |
- | |
name: Download iconv | |
working-directory: C:\cygwin\src\downloads | |
shell: pwsh | |
run: | | |
if (Test-Path -LiteralPath "libiconv-$env:ICONV_VERSION.tar.gz" -PathType Leaf) { | |
Write-Host -Object 'Already downloaded' | |
} else { | |
Invoke-WebRequest "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$env:ICONV_VERSION.tar.gz" -OutFile "libiconv-$env:ICONV_VERSION.tar.gz" | |
Write-Host -Object 'Downloaded' | |
} | |
- | |
name: Extract iconv | |
working-directory: C:\cygwin\src | |
run: tar x -z -f downloads/libiconv-$ICONV_VERSION.tar.gz | |
- | |
name: Configure iconv | |
id: iconv-configure | |
working-directory: C:\cygwin\src\libiconv-${{ env.ICONV_VERSION }} | |
run: >- | |
mkdir build | |
&& cd build | |
&& ../configure | |
CC='${{ steps.setup.outputs.mingw-host }}-gcc' | |
CXX='${{ steps.setup.outputs.mingw-host }}-g++' | |
LD='${{ steps.setup.outputs.mingw-host }}-ld' | |
CPPFLAGS='-I/usr/${{ steps.setup.outputs.mingw-host }}/sys-root/mingw/include -D__USE_MINGW_ANSI_STDIO=0 -g0 -O2' | |
LDFLAGS='-L/usr/${{ steps.setup.outputs.mingw-host }}/sys-root/mingw/lib' | |
ac_cv_func__set_invalid_parameter_handler=no | |
gl_cv_header_working_stdint_h=no | |
--host=${{ steps.setup.outputs.mingw-host }} | |
--prefix=/installed | |
--enable-relocatable | |
--config-cache | |
--disable-dependency-tracking | |
--disable-nls | |
--disable-rpath | |
--disable-acl | |
--enable-threads=windows | |
${{ steps.setup.outputs.configure-options }} | |
- | |
name: Compile iconv | |
working-directory: C:\cygwin\src\libiconv-${{ env.ICONV_VERSION }}\build | |
run: make --jobs=$(nproc) | |
- | |
name: Check iconv | |
working-directory: C:\cygwin\src\libiconv-${{ env.ICONV_VERSION }}\build | |
run: make check --jobs=$(nproc) | |
- | |
name: Install iconv | |
working-directory: C:\cygwin\src\libiconv-${{ env.ICONV_VERSION }}\build | |
run: make install && cp ../COPYING /installed/iconv-license.txt | |
- | |
name: Download gettext | |
working-directory: C:\cygwin\src\downloads | |
shell: pwsh | |
run: | | |
if (Test-Path -LiteralPath "gettext-$env:GETTEXT_VERSION.tar.xz" -PathType Leaf) { | |
Write-Host -Object 'Already downloaded' | |
} else { | |
Invoke-WebRequest "https://ftp.gnu.org/pub/gnu/gettext/gettext-$env:GETTEXT_VERSION.tar.xz" -OutFile "gettext-$env:GETTEXT_VERSION.tar.xz" | |
Write-Host -Object 'Downloaded' | |
} | |
- | |
name: Extract gettext | |
working-directory: C:\cygwin\src | |
run: tar x -J -f downloads/gettext-$GETTEXT_VERSION.tar.xz | |
- | |
name: Configure gettext | |
id: gettext-configure | |
working-directory: C:\cygwin\src\gettext-${{ env.GETTEXT_VERSION }} | |
# See https://savannah.gnu.org/bugs/?66232 for gl_cv_header_working_stdint_h=no | |
run: >- | |
mkdir build | |
&& cd build | |
&& ../configure | |
CC='${{ steps.setup.outputs.mingw-host }}-gcc' | |
CXX='${{ steps.setup.outputs.mingw-host }}-g++' | |
LD='${{ steps.setup.outputs.mingw-host }}-ld' | |
CPPFLAGS='-I/installed/include -I/usr/${{ steps.setup.outputs.mingw-host }}/sys-root/mingw/include -D__USE_MINGW_ANSI_STDIO=0 -g0 -O2 ${{ steps.setup.outputs.gettext-cppflags }}' | |
LDFLAGS='-L/installed/lib -L/usr/${{ steps.setup.outputs.mingw-host }}/sys-root/mingw/lib' | |
ac_cv_func__set_invalid_parameter_handler=no | |
gl_cv_header_working_stdint_h=no | |
--host=${{ steps.setup.outputs.mingw-host }} | |
--prefix=/installed | |
--enable-relocatable | |
--config-cache | |
--disable-dependency-tracking | |
--enable-nls | |
--disable-rpath | |
--disable-acl | |
--enable-threads=windows | |
--disable-java | |
--disable-native-java | |
--disable-csharp | |
--disable-openmp | |
--disable-curses | |
--without-emacs | |
--with-included-libxml | |
--without-bzip2 | |
--without-xz | |
${{ steps.setup.outputs.configure-options }} | |
- | |
name: Ignore gettext C tests | |
if: steps.setup.outputs.gettext-ignore-tests-c | |
working-directory: C:\cygwin\src\gettext-${{ env.GETTEXT_VERSION }} | |
run: for f in ${{ steps.setup.outputs.gettext-ignore-tests-c }}; do echo 'int main() { return 0; }' >$f; done | |
- | |
name: Compile gettext | |
working-directory: C:\cygwin\src\gettext-${{ env.GETTEXT_VERSION }}\build | |
run: make --jobs=$(nproc) | |
- | |
name: Check gettext | |
working-directory: C:\cygwin\src\gettext-${{ env.GETTEXT_VERSION }}\build | |
run: XFAIL_TESTS='${{ steps.setup.outputs.gettext-xfail-tests }}' make check --jobs=$(nproc) | |
- | |
name: Install gettext | |
working-directory: C:\cygwin\src\gettext-${{ env.GETTEXT_VERSION }}\build | |
run: make install && cp ../COPYING /installed/gettext-license.txt | |
- | |
name: Copy built assets | |
run: ./.github/workflows/build-exe-create-output /installed /output '${{ steps.setup.outputs.mingw-host }}' | |
- | |
name: Check dependencies | |
shell: pwsh | |
run: ./.github/workflows/build-exe-dependencies.ps1 ${{ matrix.bits }} ${{ matrix.link }} C:\cygwin\output C:\cygwin\usr\${{ steps.setup.outputs.mingw-host }} | |
- | |
name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.link }}-${{ matrix.bits }} | |
path: C:\cygwin\output | |
if-no-files-found: error | |
- | |
name: Prepare failure log | |
id: prepare-failure-log | |
if: failure() && steps.setup-cygwin.outcome == 'success' | |
run: >- | |
mkdir /failure-log | |
&& if [ -d /src/libiconv-$ICONV_VERSION/build ]; then tar c -J -f /failure-log/iconv.tar.xz /src/libiconv-$ICONV_VERSION/build; fi | |
&& if [ -d /src/gettext-$GETTEXT_VERSION/build ]; then tar c -J -f /failure-log/gettext.tar.xz /src/gettext-$GETTEXT_VERSION/build; fi | |
&& if [ -d /installed ]; then tar c -J -f /failure-log/installed.tar.xz /installed; fi | |
&& ls -al /failure-log | |
- | |
name: Upload failure log | |
if: always() && steps.prepare-failure-log.outcome == 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failure-log-${{ matrix.link }}-${{ matrix.bits }} | |
if-no-files-found: ignore | |
retention-days: 1 | |
include-hidden-files: true | |
compression-level: 0 | |
path: C:\cygwin\failure-log | |
- | |
name: Persist cache | |
if: always() && steps.restore-cache.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
path: | | |
C:\cygwin-packages | |
C:\cygwin\src\downloads |