Skip to content

Commit edf711e

Browse files
authored
Always use standard MacOS package to suppress warning (#56)
CMake 3.19 and above provide two Mac packages: cmake-3.19.4-macos-universal.dmg cmake-3.19.4-macos10.10-universal.dmg The 10.10 package uses OSX deployment target 10.10, while the standard package uses 10.13. As the oldest (and now deprecated) github runner is on 10.15 we can safely choose to use the standard package. https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners Keeping both packages available for selection causes a warning on all MacOS builds, so we can filter out the old packages to avoid this.
1 parent a14d8d9 commit edf711e

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

__tests__/setup-cmake.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ describe('Using version 3.19.3', () => {
268268
},
269269
{
270270
name: 'cmake-3.19.3-macos10.10-universal.tar.gz',
271-
platform: 'darwin',
271+
platform: 'darwin10.10',
272272
arch: 'x86_64',
273273
filetype: 'archive',
274274
url: 'https://fakeaddress.com/cmake-3.19.3-macos-universal.tar.gz',

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/setup-cmake.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,38 @@ function getURL(
3030
`Could not find ${process.platform} asset for cmake version ${version.name}`
3131
);
3232
}
33+
core.debug(
34+
`Assets matching platform and arch: ${matching_assets.map((a) => a.name)}`
35+
);
3336
if (matching_assets.length > 1) {
34-
core.warning(`Found ${matching_assets.length} matching packages.`);
3537
// If there are multiple assets it is likely to be because there are MacOS
3638
// builds for PPC, x86 and x86_64. Universal packages prevent parsing the
37-
// architecture completely, so we need to match against the full url to
39+
// architecture completely, so we need to match against the full name to
3840
// differentiate between e.g. cmake-2.8.10.2-Darwin-universal.tar.gz and
3941
// cmake-2.8.10.2-Darwin64-universal.tar.gz.
4042
// Check to see if this narrows down the options or just removes all options.
4143
// Prefer to use all previous matches when none of them include '64'.
42-
const possible_assets = matching_assets.filter((a) => a.url.match('64'));
44+
//
45+
// CMake 3.19 and above provide two Mac packages:
46+
// * cmake-3.19.4-macos-universal.dmg
47+
// * cmake-3.19.4-macos10.10-universal.dmg
48+
// The 10.10 package uses OSX deployment target 10.10, while the standard
49+
// package uses 10.13. As the oldest (and now deprecated) github runner is
50+
// on 10.15 we can safely choose to use the standard package.
51+
// https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
52+
const possible_assets = matching_assets.filter(
53+
(a) => a.url.match('64') || a.name.match(/macos-universal/)
54+
);
4355
if (possible_assets.length > 0) {
4456
matching_assets = possible_assets;
4557
}
58+
if (matching_assets.length > 1) {
59+
core.warning(
60+
`Found ${
61+
matching_assets.length
62+
} matching packages: ${matching_assets.map((a) => a.name)}`
63+
);
64+
}
4665
}
4766
const asset_url: string = matching_assets[0].url;
4867
const num_found: number = matching_assets.length;

0 commit comments

Comments
 (0)