Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b14481040a | ||
|
|
88fdaa7568 | ||
|
|
9b82c25a31 | ||
|
|
e15318b1da | ||
|
|
fc32c521f1 | ||
|
|
126ac36d04 |
10
README.md
10
README.md
@@ -6,11 +6,11 @@ This action sets up a flutter environment for use in actions. It works on Linux,
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: '12.x'
|
java-version: '12.x'
|
||||||
- uses: subosito/flutter-action@master
|
- uses: subosito/flutter-action@v1
|
||||||
with:
|
with:
|
||||||
version: '1.7.8+hotfix.4'
|
version: '1.7.8+hotfix.4'
|
||||||
- run: flutter pub get
|
- run: flutter pub get
|
||||||
@@ -29,11 +29,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-java@v1.0.1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: '12.x'
|
java-version: '12.x'
|
||||||
- uses: subosito/flutter-action@master
|
- uses: subosito/flutter-action@v1
|
||||||
with:
|
with:
|
||||||
version: '1.7.8+hotfix.4'
|
version: '1.7.8+hotfix.4'
|
||||||
- run: flutter pub get
|
- run: flutter pub get
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe('installer tests', () => {
|
|||||||
await installer.getFlutter('1.7.8+hotfix.4', 'stable');
|
await installer.getFlutter('1.7.8+hotfix.4', 'stable');
|
||||||
const sdkDir = path.join(
|
const sdkDir = path.join(
|
||||||
toolDir,
|
toolDir,
|
||||||
'Flutter',
|
'flutter',
|
||||||
'1.7.8-hotfix.4-stable',
|
'1.7.8-hotfix.4-stable',
|
||||||
'x64'
|
'x64'
|
||||||
);
|
);
|
||||||
@@ -40,9 +40,19 @@ describe('installer tests', () => {
|
|||||||
|
|
||||||
it('Downloads flutter from beta channel', async () => {
|
it('Downloads flutter from beta channel', async () => {
|
||||||
await installer.getFlutter('1.8.3', 'beta');
|
await installer.getFlutter('1.8.3', 'beta');
|
||||||
const sdkDir = path.join(toolDir, 'Flutter', '1.8.3-beta', 'x64');
|
const sdkDir = path.join(toolDir, 'flutter', '1.8.3-beta', 'x64');
|
||||||
|
|
||||||
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
|
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
|
||||||
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
|
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
|
it('Throws if no location contains correct flutter version', async () => {
|
||||||
|
let thrown = false;
|
||||||
|
try {
|
||||||
|
await installer.getFlutter('1000.0', 'dev');
|
||||||
|
} catch {
|
||||||
|
thrown = true;
|
||||||
|
}
|
||||||
|
expect(thrown).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function getFlutter(version, channel) {
|
|||||||
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
|
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
|
||||||
const semver = version.replace('+', '-');
|
const semver = version.replace('+', '-');
|
||||||
const cleanver = `${semver}-${channel}`;
|
const cleanver = `${semver}-${channel}`;
|
||||||
let toolPath = tc.find('Flutter', cleanver);
|
let toolPath = tc.find('flutter', cleanver);
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.debug(`Tool found in cache ${toolPath}`);
|
core.debug(`Tool found in cache ${toolPath}`);
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ function getFlutter(version, channel) {
|
|||||||
let tempDir = generateTempDir();
|
let tempDir = generateTempDir();
|
||||||
const sdkDir = yield extractDownload(sdkFile, tempDir);
|
const sdkDir = yield extractDownload(sdkFile, tempDir);
|
||||||
core.debug(`Flutter sdk extracted to ${sdkDir}`);
|
core.debug(`Flutter sdk extracted to ${sdkDir}`);
|
||||||
toolPath = yield tc.cacheDir(sdkDir, 'Flutter', cleanver);
|
toolPath = yield tc.cacheDir(sdkDir, 'flutter', cleanver);
|
||||||
}
|
}
|
||||||
core.exportVariable('FLUTTER_HOME', toolPath);
|
core.exportVariable('FLUTTER_HOME', toolPath);
|
||||||
core.addPath(path.join(toolPath, 'bin'));
|
core.addPath(path.join(toolPath, 'bin'));
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flutter-action",
|
"name": "flutter-action",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "flutter-action",
|
"name": "flutter-action",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "flutter action",
|
"description": "Flutter environment for use in actions",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export async function getFlutter(
|
|||||||
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
|
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
|
||||||
const semver = version.replace('+', '-');
|
const semver = version.replace('+', '-');
|
||||||
const cleanver = `${semver}-${channel}`;
|
const cleanver = `${semver}-${channel}`;
|
||||||
let toolPath = tc.find('Flutter', cleanver);
|
let toolPath = tc.find('flutter', cleanver);
|
||||||
|
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.debug(`Tool found in cache ${toolPath}`);
|
core.debug(`Tool found in cache ${toolPath}`);
|
||||||
@@ -49,7 +49,7 @@ export async function getFlutter(
|
|||||||
const sdkDir = await extractDownload(sdkFile, tempDir);
|
const sdkDir = await extractDownload(sdkFile, tempDir);
|
||||||
core.debug(`Flutter sdk extracted to ${sdkDir}`);
|
core.debug(`Flutter sdk extracted to ${sdkDir}`);
|
||||||
|
|
||||||
toolPath = await tc.cacheDir(sdkDir, 'Flutter', cleanver);
|
toolPath = await tc.cacheDir(sdkDir, 'flutter', cleanver);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.exportVariable('FLUTTER_HOME', toolPath);
|
core.exportVariable('FLUTTER_HOME', toolPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user