| 1 |
name: Cross-compile with mingw |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
push: |
| 6 |
branches: [ master ] |
| 7 |
paths: |
| 8 |
- '**.h' |
| 9 |
- '**.c' |
| 10 |
- 'liblouis/liblouis/liblouis.h.in' |
| 11 |
pull_request: |
| 12 |
branches: [ master ] |
| 13 |
paths: |
| 14 |
- '**.h' |
| 15 |
- '**.c' |
| 16 |
- 'liblouis/liblouis/liblouis.h.in' |
| 17 |
|
| 18 |
env: |
| 19 |
LIBYAML_VERSION: 0.1.4 |
| 20 |
|
| 21 |
jobs: |
| 22 |
build: |
| 23 |
name: Build for win64 |
| 24 |
|
| 25 |
runs-on: ubuntu-22.04 |
| 26 |
env: |
| 27 |
HOST: x86_64-w64-mingw32 |
| 28 |
PREFIX: /tmp/build/win64 |
| 29 |
|
| 30 |
steps: |
| 31 |
- name: Harden Runner |
| 32 |
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 |
| 33 |
with: |
| 34 |
egress-policy: audit |
| 35 |
|
| 36 |
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 37 |
- name: Install dependencies |
| 38 |
run: sudo apt-get update -qq && sudo apt-get install -y autoconf automake curl libtool make mingw-w64 pkg-config texinfo wine64 zip patch jq |
| 39 |
- name: Build libyaml |
| 40 |
run: | |
| 41 |
curl -L https://github.com/yaml/libyaml/archive/${{ env.LIBYAML_VERSION }}.tar.gz | tar zx |
| 42 |
cd libyaml-${{ env.LIBYAML_VERSION }} |
| 43 |
patch -p1 < ../libyaml_mingw.patch |
| 44 |
./bootstrap |
| 45 |
./configure --host ${{ env.HOST }} --prefix=${{ env.PREFIX }} |
| 46 |
make |
| 47 |
make install |
| 48 |
- name: Autogen && configure |
| 49 |
run: | |
| 50 |
./autogen.sh |
| 51 |
./configure --host ${{ env.HOST }} --enable-ucs4 --prefix=${{ env.PREFIX }} CPPFLAGS="-I${{ env.PREFIX }}/include/" LDFLAGS="-L${{ env.PREFIX }}/lib/" |
| 52 |
- name: Make |
| 53 |
run: make LDFLAGS="-L${{ env.PREFIX }}/lib/ -avoid-version -Xcompiler -static-libgcc" |
| 54 |
- name: Check |
| 55 |
run: make check WINE=wine64 |
| 56 |
- name: Store the test suite log |
| 57 |
if: ${{ failure() }} |
| 58 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a |
| 59 |
with: |
| 60 |
name: test-suite-w64.log |
| 61 |
path: tests/test-suite.log |
| 62 |
- name: Install |
| 63 |
run: make install |
| 64 |
|
| 65 |
- name: Zip up the build artifacts |
| 66 |
run: ( cd ${{ env.PREFIX }}; zip -r liblouis.zip * ) |
| 67 |
- name: Archive the build artifacts |
| 68 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a |
| 69 |
with: |
| 70 |
name: liblouis-w64.zip |
| 71 |
path: ${{ env.PREFIX }}/liblouis.zip |
| 72 |
|
| 73 |
- name: Upload the assets to the snapshot release |
| 74 |
|
| 75 |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository =='liblouis/liblouis'}} |
| 76 |
uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 |
| 77 |
with: |
| 78 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 79 |
upload_url: https://uploads.github.com/repos/liblouis/liblouis/releases/8031256/assets{?name,label} |
| 80 |
asset_path: ${{ env.PREFIX }}/liblouis.zip |
| 81 |
asset_name: liblouis-w64.zip |
| 82 |
asset_content_type: application/zip |
| 83 |
overwrite: true |
| 84 |
|
| 85 |
- name: Edit the description of the snapshot release |
| 86 |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository =='liblouis/liblouis'}} |
| 87 |
run: | |
| 88 |
if ! curl -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 89 |
-H "Accept: application/json" \ |
| 90 |
-H "Content-type: application/json" \ |
| 91 |
-X PATCH \ |
| 92 |
"https://api.github.com/repos/liblouis/liblouis/releases/8031256" \ |
| 93 |
-d "{\"tag_name\": \"snapshot\", \ |
| 94 |
\"body\": \"Latest build: ${{ github.sha }}\"}" \ |
| 95 |
2>/dev/null \ |
| 96 |
| jq -e '.url'; \ |
| 97 |
then \ |
| 98 |
echo "Failed to edit release description" && \ |
| 99 |
exit 1; \ |
| 100 |
fi |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|