Compare commits

...

9 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
Alif Rachmawadi
f91c7a64ef bump version
Some checks failed
Main workflow / Run (macos-latest) (push) Failing after 3s
Main workflow / Run (ubuntu-latest) (push) Successful in 3m32s
Main workflow / Run (windows-latest) (push) Has been cancelled
2019-08-14 08:07:47 +07:00
Alif Rachmawadi
048d11febc semver and channel for cache dir 2019-08-14 08:04:35 +07:00
Alif Rachmawadi
aedc3a9f1e removed whitespace 2019-08-14 07:34:44 +07:00
7 changed files with 35 additions and 18 deletions

View File

@@ -10,17 +10,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set Node.js 10.x
uses: actions/setup-node@master
with:
version: 10.x
- name: npm install
run: npm install
- name: Lint
run: npm run format-check
- name: npm test
run: npm test

View File

@@ -6,11 +6,11 @@ This action sets up a flutter environment for use in actions. It works on Linux,
```yaml
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@master
- uses: subosito/flutter-action@v1
with:
version: '1.7.8+hotfix.4'
- run: flutter pub get
@@ -29,11 +29,11 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@master
- uses: actions/setup-java@v1.0.1
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@master
- uses: subosito/flutter-action@v1
with:
version: '1.7.8+hotfix.4'
- run: flutter pub get

View File

@@ -27,7 +27,12 @@ describe('installer tests', () => {
it('Downloads flutter', async () => {
await installer.getFlutter('1.7.8+hotfix.4', 'stable');
const sdkDir = path.join(toolDir, 'Flutter', '1.7.8', 'x64');
const sdkDir = path.join(
toolDir,
'flutter',
'1.7.8-hotfix.4-stable',
'x64'
);
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
@@ -35,9 +40,19 @@ describe('installer tests', () => {
it('Downloads flutter from beta channel', async () => {
await installer.getFlutter('1.8.3', 'beta');
const sdkDir = path.join(toolDir, 'Flutter', '1.8.3', 'x64');
const sdkDir = path.join(toolDir, 'flutter', '1.8.3-beta', 'x64');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 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

@@ -46,7 +46,10 @@ if (!tempDirectory) {
}
function getFlutter(version, channel) {
return __awaiter(this, void 0, void 0, function* () {
let toolPath = tc.find('Flutter', version);
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
const semver = version.replace('+', '-');
const cleanver = `${semver}-${channel}`;
let toolPath = tc.find('flutter', cleanver);
if (toolPath) {
core.debug(`Tool found in cache ${toolPath}`);
}
@@ -57,7 +60,7 @@ function getFlutter(version, channel) {
let tempDir = generateTempDir();
const sdkDir = yield extractDownload(sdkFile, tempDir);
core.debug(`Flutter sdk extracted to ${sdkDir}`);
toolPath = yield tc.cacheDir(sdkDir, 'Flutter', version);
toolPath = yield tc.cacheDir(sdkDir, 'flutter', cleanver);
}
core.exportVariable('FLUTTER_HOME', toolPath);
core.addPath(path.join(toolPath, 'bin'));

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "flutter-action",
"version": "1.0.0",
"version": "1.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,8 +1,8 @@
{
"name": "flutter-action",
"version": "1.0.0",
"version": "1.0.2",
"private": true,
"description": "flutter action",
"description": "Flutter environment for use in actions",
"main": "lib/index.js",
"scripts": {
"build": "tsc",

View File

@@ -32,7 +32,10 @@ export async function getFlutter(
version: string,
channel: string
): Promise<void> {
let toolPath = tc.find('Flutter', version);
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
const semver = version.replace('+', '-');
const cleanver = `${semver}-${channel}`;
let toolPath = tc.find('flutter', cleanver);
if (toolPath) {
core.debug(`Tool found in cache ${toolPath}`);
@@ -46,7 +49,7 @@ export async function getFlutter(
const sdkDir = await extractDownload(sdkFile, tempDir);
core.debug(`Flutter sdk extracted to ${sdkDir}`);
toolPath = await tc.cacheDir(sdkDir, 'Flutter', version);
toolPath = await tc.cacheDir(sdkDir, 'flutter', cleanver);
}
core.exportVariable('FLUTTER_HOME', toolPath);