Skip to content

Commit

Permalink
Always use standard MacOS package to suppress warning (#56)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jwlawson authored Apr 20, 2023
1 parent a14d8d9 commit edf711e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion __tests__/setup-cmake.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ describe('Using version 3.19.3', () => {
},
{
name: 'cmake-3.19.3-macos10.10-universal.tar.gz',
platform: 'darwin',
platform: 'darwin10.10',
arch: 'x86_64',
filetype: 'archive',
url: 'https://fakeaddress.com/cmake-3.19.3-macos-universal.tar.gz',
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions src/setup-cmake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,38 @@ function getURL(
`Could not find ${process.platform} asset for cmake version ${version.name}`
);
}
core.debug(
`Assets matching platform and arch: ${matching_assets.map((a) => a.name)}`
);
if (matching_assets.length > 1) {
core.warning(`Found ${matching_assets.length} matching packages.`);
// If there are multiple assets it is likely to be because there are MacOS
// builds for PPC, x86 and x86_64. Universal packages prevent parsing the
// architecture completely, so we need to match against the full url to
// architecture completely, so we need to match against the full name to
// differentiate between e.g. cmake-2.8.10.2-Darwin-universal.tar.gz and
// cmake-2.8.10.2-Darwin64-universal.tar.gz.
// Check to see if this narrows down the options or just removes all options.
// Prefer to use all previous matches when none of them include '64'.
const possible_assets = matching_assets.filter((a) => a.url.match('64'));
//
// 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
const possible_assets = matching_assets.filter(
(a) => a.url.match('64') || a.name.match(/macos-universal/)
);
if (possible_assets.length > 0) {
matching_assets = possible_assets;
}
if (matching_assets.length > 1) {
core.warning(
`Found ${
matching_assets.length
} matching packages: ${matching_assets.map((a) => a.name)}`
);
}
}
const asset_url: string = matching_assets[0].url;
const num_found: number = matching_assets.length;
Expand Down

0 comments on commit edf711e

Please sign in to comment.