Skip to content

Commit 6326654

Browse files
committed
CI: Handle compressed and uncompressed libs better [force ci]
1 parent 1756344 commit 6326654

File tree

2 files changed

+50
-51
lines changed

2 files changed

+50
-51
lines changed

.github/workflows/integrate.yml

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,16 @@ jobs:
9898
defaults:
9999
run:
100100
shell: bash
101-
outputs:
102-
prefix: ${{ steps.os_library.outputs.prefix }}
103-
suffix: ${{ steps.os_library.outputs.suffix }}
104101
steps:
105102
- name: Checkout XKCP
106103
uses: actions/checkout@v3
107104
- name: Install Dependencies
108105
run: |
109106
case "${RUNNER_OS}" in
110-
Linux) echo "No requirement for Linux" ;;
111-
macOS) echo "No requirement for MacOS" ;;
112-
Windows) echo "No requirement for Windows" ;;
113-
*) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;;
107+
Linux) echo "No requirement for Linux" ;;
108+
macOS) echo "No requirement for MacOS" ;;
109+
Windows) echo "No requirement for Windows" ;;
110+
*) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;;
114111
esac
115112
env:
116113
HOMEBREW_NO_ENV_HINTS: true
@@ -136,32 +133,20 @@ jobs:
136133
mkdir $workingDir && cd $workingDir
137134
cmake .. -DBUILD_SHARED_LIBS=ON
138135
cmake --build .
139-
- name: Determine Filename
140-
id: os_library
141-
run: |
142-
case "${RUNNER_OS}" in
143-
Linux) echo "::set-output name=prefix::lib" && echo "::set-output name=suffix::so" ;;
144-
macOS) echo "::set-output name=prefix::lib" && echo "::set-output name=suffix::dylib" ;;
145-
Windows) echo "::set-output name=prefix::" && echo "::set-output name=suffix::DLL" ;;
146-
*) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;;
147-
esac
148136
- name: Collect & Validate
149137
run: |
150138
mkdir artifacts
151139
for arch in generic64 AVX AVX2 AVX512 SSSE3 SSE42
152140
do
153141
echo "Moving ${arch}"
154-
if [[ "${RUNNER_OS}" == "Windows" ]] ; then
155-
# Windows incorrectly builld with the lib prefix so we remove it here
156-
mv ${workingDir}/${arch}/libXKCP.${suffix} artifacts/${prefix}XKCP-${arch}.${suffix}
157-
else
158-
mv ${workingDir}/${arch}/${prefix}XKCP.${suffix} artifacts/${prefix}XKCP-${arch}.${suffix}
159-
fi
142+
case "${RUNNER_OS}" in
143+
Linux) mv ${workingDir}/${arch}/libXKCP.so artifacts/libXKCP-${arch}.so ;;
144+
macOS) mv ${workingDir}/${arch}/libXKCP.dylib artifacts/libXKCP-${arch}.dylib ;;
145+
Windows) mv ${workingDir}/${arch}/libXKCP.DLL artifacts/XKCP-${arch}.DLL ;; # Windows incorrectly builds with the lib prefix
146+
*) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;;
147+
esac
160148
done
161149
ls -laR artifacts
162-
env:
163-
prefix: ${{ steps.os_library.outputs.prefix }}
164-
suffix: ${{ steps.os_library.outputs.suffix }}
165150
- name: Upload Headers
166151
uses: actions/upload-artifact@v3
167152
if: runner.os == 'Linux'
@@ -204,10 +189,10 @@ jobs:
204189
id: os_library
205190
run: |
206191
case "${RUNNER_OS}" in
207-
Linux) echo "::set-output name=filename::libXKCP-${arch}.so" ;;
208-
macOS) echo "::set-output name=filename::libXKCP-${arch}.dylib" ;;
209-
Windows) echo "::set-output name=filename::XKCP-${arch}.DLL" ;;
210-
*) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;;
192+
Linux) echo "::set-output name=filename::libXKCP-${arch}.so" ;;
193+
macOS) echo "::set-output name=filename::libXKCP-${arch}.dylib" ;;
194+
Windows) echo "::set-output name=filename::XKCP-${arch}.DLL" ;;
195+
*) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;;
211196
esac
212197
env:
213198
arch: ${{ matrix.arch }}
@@ -240,6 +225,7 @@ jobs:
240225
runs-on: ubuntu-latest
241226
env:
242227
workingDir: build
228+
collectDir: collection
243229
defaults:
244230
run:
245231
shell: bash
@@ -248,34 +234,45 @@ jobs:
248234
uses: actions/download-artifact@v3
249235
- name: Collect
250236
run: |
251-
mkdir collection
252-
# Compressed platforms
253-
for platform in Linux Windows ; do
254-
dir=collection/${platform}
255-
mkdir ${dir}
256-
for arch in generic64 AVX AVX2 AVX512 SSSE3 SSE42 ; do
257-
echo "Copying ${platform}/${arch}"
258-
mv XKCP-${platform}-${arch}-UPX/* ${dir}/
259-
done
237+
mkdir ${collectDir}
238+
ls -lR
239+
#
240+
# Windows compressed files
241+
platform=Windows
242+
dir=${collectDir}/${platform}
243+
mkdir ${dir}
244+
echo "Created ${dir}"
245+
for arch in generic64 AVX AVX2 AVX512 SSSE3 SSE42 ; do
246+
file="XKCP-${platform}-${arch}-UPX/XKCP-${arch}.DLL"
247+
if [[ -f ${file} ]]; then
248+
echo "Copying ${file}"
249+
mv ${file} ${dir}/
250+
else
251+
echo "Skipping compression for ${arch}, did not find ${file}"
252+
mv XKCP-${platform}/XKCP-${arch}.DLL ${dir}/
253+
fi
260254
done
255+
#
261256
# Uncompressed platforms
262-
mkdir collection/macOS
263-
mv XKCP-macOS/* collection/macOS/
264-
# Set generic64 as default library on each platform
265-
mv collection/Linux/libXKCP-generic64.so collection/Linux/libXKCP.so
266-
mv collection/macOS/libXKCP-generic64.dylib collection/macOS/libXKCP.dylib
267-
mv collection/Windows/XKCP-generic64.DLL collection/Windows/XKCP.DLL
257+
for platform in Linux macOS ; do
258+
dir=${collectDir}/${platform}
259+
mkdir ${dir}
260+
mv XKCP-${platform}/* ${dir}/
261+
done
262+
#
263+
# Set generic64 as default library on all platforms
264+
mv ${collectDir}/Linux/libXKCP-generic64.so ${collectDir}/Linux/libXKCP.so
265+
mv ${collectDir}/macOS/libXKCP-generic64.dylib ${collectDir}/macOS/libXKCP.dylib
266+
mv ${collectDir}/Windows/XKCP-generic64.DLL ${collectDir}/Windows/XKCP.DLL
267+
#
268268
# Collect headers
269-
mkdir collection/Headers
270-
mv XKCP-Headers/* collection/Headers/
271-
ls -lR collection
272-
env:
273-
prefix: ${{ needs.build.outputs.prefix }}
274-
suffix: ${{ needs.build.outputs.suffix }}
269+
mkdir ${collectDir}/Headers
270+
mv XKCP-Headers/* ${collectDir}/Headers/
271+
ls -lR ${collectDir}
275272
- name: Upload Artifacts
276273
uses: actions/upload-artifact@v3
277274
with:
278275
name: XKCP
279276
path: |
280-
collection/**
277+
${{ env.collectDir }}/**
281278
if-no-files-found: error

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ bin/
33
var/
44
artifacts/
55
.DS_Store
6+
cmake-build-debug
7+
cmake-build-release

0 commit comments

Comments
 (0)