Compare commits

...

6 Commits

Author SHA1 Message Date
Alif Rachmawadi
b14481040a updated lib
Some checks failed
Main workflow / Run (macos-latest) (push) Failing after 3s
Main workflow / Run (ubuntu-latest) (push) Failing after 19m41s
Main workflow / Run (windows-latest) (push) Has been cancelled
2019-08-16 15:36:09 +07:00
Alif Rachmawadi
88fdaa7568 added test for invalid version 2019-08-16 15:34:20 +07:00
Alif Rachmawadi
9b82c25a31 use version; fixes #1 2019-08-16 09:28:18 +07:00
Alif Rachmawadi
e15318b1da bump version 2019-08-16 09:16:46 +07:00
Alif Rachmawadi
fc32c521f1 update cache path 2019-08-15 12:44:24 +07:00
Alif Rachmawadi
126ac36d04 updated usage 2019-08-14 08:13:02 +07:00
6 changed files with 24 additions and 14 deletions

View File

@@ -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

View File

@@ -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);
});
}); });

View File

@@ -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
View File

@@ -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": {

View File

@@ -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",

View File

@@ -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);