@@ -96,29 +96,59 @@ jobs:
9696 matrix :
9797 include :
9898 - arch : aarch64
99- runner : ubuntu-24.04-arm
10099
101- runs-on : ${{ matrix.runner }}
100+ runs-on : [
101+ Windows,
102+ WSL,
103+ ARM64
104+ ]
102105 name : Ubuntu cross ${{ matrix.arch }}-pc-cygwin
103106
107+ defaults :
108+ run :
109+ shell : wsl --user runner bash --noprofile --norc -euo pipefail "$(s="$(wslpath '{0}')" && sed -i 's/\r$//' "$s" && echo "$s")"
110+
104111 env :
105112 GH_TOKEN : ${{ github.token }}
106113 TOOLCHAIN_REPO : Windows-on-ARM-Experiments/mingw-woarm64-build
114+ WSLENV : CYGWIN:GH_TOKEN:GITHUB_ENV/p:GITHUB_OUTPUT/p:GITHUB_STEP_SUMMARY/p
107115
108116 steps :
109- - uses : actions/checkout@v3
117+ # prepare non-ephemeral runner environment
118+ - name : Prepare environment
119+ run : |
120+ if (Test-Path -Path newlib-cygwin) {
121+ Remove-Item -Recurse -Force newlib-cygwin
122+ }
123+ if (Test-Path -Path *-msvcrt-toolchain.tar.gz) {
124+ Remove-Item -Recurse -Force *-msvcrt-toolchain.tar.gz
125+ }
126+ if (Test-Path -Path toolchain) {
127+ Remove-Item -Recurse -Force toolchain
128+ }
129+ if (Test-Path -Path build) {
130+ Remove-Item -Recurse -Force build
131+ }
132+ if (Test-Path -Path install) {
133+ Remove-Item -Recurse -Force install
134+ }
135+ shell : powershell
110136
111137 # install build tools
112138 - name : Install build tools
113139 run : |
114- sudo apt-get update
115- sudo apt-get install -y \
140+ sudo apt update
141+ sudo apt install -y \
116142 autoconf \
117143 automake \
144+ binutils \
145+ bzip2 \
118146 dblatex \
119147 docbook2x \
120148 docbook-xsl \
121149 gawk \
150+ gcc \
151+ g++ \
122152 gh \
123153 make \
124154 openssh-client \
@@ -129,16 +159,17 @@ jobs:
129159 python3-ply \
130160 xmlto
131161
162+ # checkout
163+ - name : Checkout
164+ run : |
165+ git clone https://github.com/${{ github.repository }} -b ${{ github.ref_name }}
166+
132167 # download toolchain
133168 - name : Download toolchain
134169 run : |
135- CYGWIN_DIGEST=$(gh release view \
136- --repo ${{ env.TOOLCHAIN_REPO }} \
137- --json assets \
170+ CYGWIN_DIGEST=$(gh api repos/${{ env.TOOLCHAIN_REPO }}/releases/latest \
138171 --jq '.assets[] | select(.name | test("${{ matrix.arch }}-pc-cygwin-msvcrt-toolchain.tar.gz")).digest')
139- MINGW_DIGEST=$(gh release view \
140- --repo ${{ env.TOOLCHAIN_REPO }} \
141- --json assets \
172+ MINGW_DIGEST=$(gh api repos/${{ env.TOOLCHAIN_REPO }}/releases/latest \
142173 --jq '.assets[] | select(.name | test("${{ matrix.arch }}-w64-mingw32-msvcrt-toolchain.tar.gz")).digest')
143174 gh release download \
144175 --repo ${{ env.TOOLCHAIN_REPO }} \
@@ -157,21 +188,50 @@ jobs:
157188 # build
158189 - name : Configure, build and install
159190 run : |
160- export PATH="$PATH:${{ github.workspace }}/toolchain/${{ matrix.arch }}-w64-mingw32/bin:${{ github.workspace }}/toolchain/${{ matrix.arch }}-pc-cygwin/bin"
161- export CXXFLAGS_FOR_TARGET="-D_WIN64 -I${{ github.workspace }}/toolchain/${{ matrix.arch }}-pc-cygwin/include"
162- export LDFLAGS_FOR_TARGET="-L${{ github.workspace }}/toolchain/${{ matrix.arch }}-pc-cygwin/lib"
163- export MINGW_CPPFLAGS="-I${{ github.workspace }}/toolchain/${{ matrix.arch }}-w64-mingw32/include"
164- export MINGW_LDFLAGS="-L${{ github.workspace }}/toolchain/${{ matrix.arch }}-w64-mingw32/lib"
191+ WORKSPACE=$(realpath $(pwd))
192+ export PATH="$PATH:$WORKSPACE/build/${{ matrix.arch }}-pc-cygwin/winsup/testsuite/testinst/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/bin"
193+ export CXXFLAGS_FOR_TARGET="-I$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/include"
194+ export LDFLAGS_FOR_TARGET="-L$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/lib"
195+ export MINGW_CPPFLAGS="-I$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/include"
196+ export MINGW_LDFLAGS="-L$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/lib"
165197 export MAKEFLAGS="V=1 -j$(nproc)"
198+ export CYGWIN=winsymlinks:sys
166199
167200 mkdir build install
168- (cd winsup && ./autogen.sh)
169- (cd build && ../configure --target=${{ matrix.arch }}-pc-cygwin --prefix=$(realpath $(pwd)/../install) )
201+ (cd newlib-cygwin/ winsup && ./autogen.sh)
202+ (cd build && ../newlib-cygwin/ configure --target=${{ matrix.arch }}-pc-cygwin --prefix=$(realpath $(pwd)/../install) )
170203 make -C build
171204 make -C build/*/newlib info man
172205 make -C build install
173206 make -C build/*/newlib install-info install-man
174207
208+ # test
209+ - name : Test Cygwin
210+ continue-on-error : true
211+ run : |
212+ WORKSPACE=$(realpath $(pwd))
213+ export PATH="$PATH:$WORKSPACE/build/${{ matrix.arch }}-pc-cygwin/winsup/testsuite/testinst/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/bin"
214+ export CXXFLAGS_FOR_TARGET="-I$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/include"
215+ export LDFLAGS_FOR_TARGET="-L$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/lib"
216+ export MINGW_CPPFLAGS="-I$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/include"
217+ export MINGW_LDFLAGS="-L$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/lib"
218+ export CYGWIN=winsymlinks:sys
219+
220+ (cd build/${{ matrix.arch }}-pc-cygwin/winsup && WSLENV="$WSLENV:PATH/l" make V=1 check AM_COLOR_TESTS=always)
221+
222+ - name : Pack build folder
223+ if : failure()
224+ run : |
225+ tar -cjf build.tar.bz2 build/
226+
227+ - name : Upload build folder
228+ if : failure()
229+ uses : actions/upload-artifact@v4
230+ with :
231+ name : cygwin-build
232+ retention-days : 1
233+ path : build.tar.bz2
234+
175235 windows-build :
176236 runs-on : windows-latest
177237 strategy :
0 commit comments