Skip to content

Commit

Permalink
add ˜3.0.0 test, and add diag msg
Browse files Browse the repository at this point in the history
  • Loading branch information
lukka committed Feb 2, 2023
1 parent 9b13337 commit 1a178d4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 15 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ jobs:
uses: ./.github/workflows/functional-tests-tmpl.yml
with:
runs-on: "['ubuntu-latest', 'macos-latest', 'windows-latest']"
versions: "[\"{'cmake':'','ninja':''}\",\
\"{cmake:'3.22.6', 'ninja':'1.11.1'}\",\
\"{'cmake':'3.25.0-rc4','ninja':'latest'}\",\
\"{'cmake':'latest','ninja':'~1.11.0'}\",\
\"{'cmake':'latestrc','ninja':'^1.11.0'}\",\
\"{'cmake':'~3.25.0','ninja':''}\",\
\"{'cmake':'^3.1.1','ninja':''}\",\
\"{'cmake':'~3.0.0','ninja':''}\"]"
secrets:
token:
${{ github.token }}
Expand All @@ -52,6 +60,13 @@ jobs:
with:
runs-on: "['buildjet-2vcpu-ubuntu-2204-arm']"
experimental: true
versions: "[\"{'cmake':'','ninja':''}\",\
\"{cmake:'3.22.6', 'ninja':'1.11.1'}\",\
\"{'cmake':'3.25.0-rc4','ninja':'latest'}\",\
\"{'cmake':'latest','ninja':'~1.11.0'}\",\
\"{'cmake':'latestrc','ninja':'^1.11.0'}\",\
\"{'cmake':'~3.25.0','ninja':''}\",\
\"{'cmake':'^3.1.1','ninja':''}\"]"
secrets:
token:
${{ github.token }}
24 changes: 10 additions & 14 deletions .github/workflows/functional-tests-tmpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,22 @@ on:
required: false
type: boolean
default: false
versions:
type: string
secrets:
token:
required: true

jobs:
test_user_provided_versions:
name: '${{ matrix.os }}: functional test (${{ matrix.cmake }})'
name: '${{ matrix.os }}: functional test (${{ matrix.versions }})'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ inputs.experimental }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(inputs.runs-on) }}
cmake: ["{'cmake':'','ninja':''}",
"{cmake:'3.22.6', 'ninja':'1.11.1'}",
"{'cmake':'3.25.0-rc4','ninja':'latest'}",
"{'cmake':'latest','ninja':'~1.11.0'}",
"{'cmake':'latestrc','ninja':'^1.11.0'}",
"{'cmake':'~3.25.0','ninja':''}",
"{'cmake':'^3.1.1','ninja':''}"]
versions: ${{ fromJson(inputs.versions) }}

steps:
- uses: actions/checkout@v3
Expand All @@ -42,14 +38,14 @@ jobs:
- uses: ./
name: validation test by running get-cmake with specific input
with:
cmakeVersion: ${{ fromJSON(matrix.cmake).cmake }}
ninjaVersion: ${{ fromJSON(matrix.cmake).ninja }}
- name: CMake version check ${{ fromJSON(matrix.cmake).cmake }}
cmakeVersion: ${{ fromJSON(matrix.versions).cmake }}
ninjaVersion: ${{ fromJSON(matrix.versions).ninja }}
- name: CMake version check ${{ fromJSON(matrix.versions).cmake }}
run: |
which cmake
cmake --version
CMAKE_VER="$(cmake --version)"
CMAKE_REQUESTED_VER="${{ fromJSON(matrix.cmake).cmake }}"
CMAKE_REQUESTED_VER="${{ fromJSON(matrix.versions).cmake }}"
case ${CMAKE_REQUESTED_VER} in
'latest')
EXPECTED_CMAKE_VER=`cat .latest_cmake_version`
Expand Down Expand Up @@ -80,12 +76,12 @@ jobs:
exit -1
fi
shell: bash
- name: ninja version check ${{ fromJSON(matrix.cmake).ninja }}
- name: ninja version check ${{ fromJSON(matrix.versions).ninja }}
run: |
which ninja
ninja --version
NINJA_VER="$(ninja --version)"
NINJA_REQUESTED_VER="${{ fromJSON(matrix.cmake).ninja }}"
NINJA_REQUESTED_VER="${{ fromJSON(matrix.versions).ninja }}"
case ${NINJA_REQUESTED_VER} in
'latest')
EXPECTED_NINJA_VER=`cat .latest_ninja_version`
Expand Down
11 changes: 11 additions & 0 deletions __tests__/action_succeeded.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ test('testing get-cmake action success with specific cmake versions', async () =
expect(coreError).toBeCalledTimes(0);
}

// '~3.0.0' is not avail on Linux ARM/ARM64.
if (process.platform !== "linux" && !process.arch.startsWith("arm")) {
for (var version of ["~3.0.0"]) {
process.env.RUNNER_TEMP = os.tmpdir();
process.env["CUSTOM_CMAKE_VERSION"] = version;
await getcmake.main();
expect(coreSetFailed).toBeCalledTimes(0);
expect(coreError).toBeCalledTimes(0);
}
}

// A Linux ARM build is not available before 3.19.x
if (process.platform === "linux" && process.arch === "x64") {
for (var version of ["3.18.3", "3.16.1", "3.5.2", "3.3.0", "3.1.2"]) {
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/get-cmake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class ToolsGetter {
if (!cmakePackages)
throw Error(`Cannot find CMake version:'${this.requestedCMakeVersion}' in the catalog.`);
const cmakePackage = cmakePackages[targetArchPlat];
core.debug(`cmakePackages: ${JSON.stringify(cmakePackages)}`);
if (!cmakePackage)
throw Error(`Cannot find CMake version:'${this.requestedCMakeVersion}' in the catalog for the '${targetArchPlat}' platform.`);

Expand Down

0 comments on commit 1a178d4

Please sign in to comment.