-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use @actions/cache package;bump cmake to v3.18.2
- Loading branch information
Showing
50 changed files
with
57,694 additions
and
27,925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ token.txt | |
build | ||
__tests__/build Directory | ||
__tests__/b | ||
.npmrc | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2020 Luca Cappa | ||
// Released under the term specified in file LICENSE.txt | ||
// SPDX short identifier: MIT | ||
|
||
import * as os from 'os'; | ||
import * as cache from '@actions/cache'; | ||
import * as toolcache from '@actions/tool-cache'; | ||
import * as core from '@actions/core'; | ||
import * as getcmake from '../src/get-cmake'; | ||
|
||
jest.setTimeout(15 * 1000); | ||
|
||
jest.mock('@actions/tool-cache'); | ||
|
||
jest.spyOn(cache, 'saveCache').mockImplementation(() => | ||
Promise.resolve(0) | ||
); | ||
|
||
jest.spyOn(cache, 'restoreCache').mockImplementation(() => { | ||
throw new Error(); | ||
} | ||
); | ||
|
||
var coreSetFailed = jest.spyOn(core, 'setFailed'); | ||
var coreError = jest.spyOn(core, 'error'); | ||
var toolsCacheDir = jest.spyOn(toolcache, 'cacheDir'); | ||
|
||
test('testing get-cmake action failure', async () => { | ||
process.env.RUNNER_TEMP = os.tmpdir(); | ||
await getcmake.main(); | ||
expect(coreSetFailed).toBeCalledTimes(1); | ||
expect(coreError).toBeCalledTimes(0); | ||
expect(toolsCacheDir).toBeCalledTimes(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2020 Luca Cappa | ||
// Released under the term specified in file LICENSE.txt | ||
// SPDX short identifier: MIT | ||
|
||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import * as getcmake from '../src/get-cmake'; | ||
import * as cache from '@actions/cache'; | ||
import * as toolcache from '@actions/tool-cache'; | ||
import * as core from '@actions/core'; | ||
|
||
jest.setTimeout(15 * 1000) | ||
|
||
jest.mock('@actions/tool-cache'); | ||
|
||
jest.spyOn(cache, 'saveCache').mockImplementation(() => | ||
Promise.resolve(0) | ||
); | ||
|
||
jest.spyOn(cache, 'restoreCache').mockImplementation(() => | ||
Promise.resolve("42") | ||
); | ||
|
||
var coreSetFailed = jest.spyOn(core, 'setFailed'); | ||
var coreError = jest.spyOn(core, 'error'); | ||
var toolsCacheDir = jest.spyOn(toolcache, 'cacheDir'); | ||
|
||
test('testing get-cmake action success', async () => { | ||
process.env.RUNNER_TEMP = os.tmpdir(); | ||
await getcmake.main(); | ||
expect(coreSetFailed).toBeCalledTimes(0); | ||
expect(coreError).toBeCalledTimes(0); | ||
expect(toolsCacheDir).toBeCalledTimes(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2020 Luca Cappa | ||
// Released under the term specified in file LICENSE.txt | ||
// SPDX short identifier: MIT | ||
|
||
import * as process from 'process'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { CMakeGetter } from '../src/get-cmake'; | ||
import * as cache from '@actions/cache'; | ||
import * as core from '@actions/core'; | ||
import * as tools from '@actions/tool-cache' | ||
|
||
|
||
jest.setTimeout(15 * 1000) | ||
|
||
jest.mock('@actions/tool-cache'); | ||
|
||
const cacheSaveCache = jest.spyOn(cache, 'saveCache').mockImplementation(() => | ||
Promise.resolve(0) | ||
); | ||
|
||
const cacheRestoreCache = jest.spyOn(cache, 'restoreCache').mockImplementation(() => | ||
Promise.resolve("key") | ||
); | ||
|
||
test('testing get-cache with cache-hit...', async () => { | ||
process.env.RUNNER_TEMP = os.tmpdir(); | ||
const getter: CMakeGetter = new CMakeGetter(); | ||
await getter.run(); | ||
expect(cacheSaveCache).toBeCalledTimes(0); | ||
expect(cacheRestoreCache).toBeCalledTimes(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) 2020 Luca Cappa | ||
// Released under the term specified in file LICENSE.txt | ||
// SPDX short identifier: MIT | ||
|
||
import * as process from 'process'; | ||
import * as os from 'os'; | ||
import { CMakeGetter } from '../src/get-cmake'; | ||
import * as cache from '@actions/cache'; | ||
import * as core from '@actions/core'; | ||
|
||
jest.setTimeout(15 * 1000) | ||
jest.mock('@actions/tool-cache'); | ||
|
||
var coreSetFailed = jest.spyOn(core, 'setFailed'); | ||
|
||
const cacheSaveCache = jest.spyOn(cache, 'saveCache').mockImplementation(() => | ||
Promise.resolve(0) | ||
); | ||
|
||
const cacheRestoreCache = jest.spyOn(cache, 'restoreCache').mockImplementation(() => | ||
Promise.resolve(undefined) | ||
); | ||
|
||
test('testing get-cache with cache-miss...', async () => { | ||
process.env.RUNNER_TEMP = os.tmpdir(); | ||
const getter: CMakeGetter = new CMakeGetter(); | ||
await getter.run(); | ||
expect(cacheSaveCache).toBeCalledTimes(1); | ||
expect(cacheRestoreCache).toBeCalledTimes(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2020 Luca Cappa | ||
// Released under the term specified in file LICENSE.txt | ||
// SPDX short identifier: MIT | ||
|
||
import * as process from 'process'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { CMakeGetter } from '../src/get-cmake'; | ||
import * as cache from '@actions/cache'; | ||
|
||
jest.setTimeout(15 * 1000) | ||
|
||
jest.mock('@actions/tool-cache'); | ||
|
||
jest.spyOn(cache, 'saveCache').mockImplementation(() => | ||
Promise.resolve(0) | ||
); | ||
|
||
jest.spyOn(cache, 'restoreCache').mockImplementation(() => { | ||
throw new Error(); | ||
} | ||
); | ||
|
||
test('testing get-cache with restoreCache failure', async () => { | ||
process.env.RUNNER_TEMP = os.tmpdir(); | ||
const getter: CMakeGetter = new CMakeGetter(); | ||
await expect(getter.run()).rejects.toThrowError(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2020 Luca Cappa | ||
// Released under the term specified in file LICENSE.txt | ||
// SPDX short identifier: MIT | ||
|
||
import * as path from 'path'; | ||
import { CMakeGetter } from '../src/get-cmake'; | ||
import * as cache from '@actions/cache'; | ||
|
||
const tempDirectory = path.join(__dirname, "tempDirectory"); | ||
const testScript = path.join(__dirname, '..', 'dist', 'index.js');; | ||
|
||
jest.setTimeout(15 * 1000) | ||
|
||
jest.mock('@actions/tool-cache'); | ||
|
||
jest.spyOn(cache, 'saveCache').mockImplementation(() => | ||
Promise.resolve(0) | ||
); | ||
|
||
jest.spyOn(cache, 'restoreCache').mockImplementation(() => { | ||
throw new Error(); | ||
} | ||
); | ||
|
||
test('testing get-cache with no temporary directory failure', async () => { | ||
delete process.env.RUNNER_TEMP; | ||
const getter: CMakeGetter = new CMakeGetter(); | ||
await expect(getter.run()).rejects.toThrowError(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.