Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b14481040a | ||
|
|
88fdaa7568 | ||
|
|
9b82c25a31 | ||
|
|
e15318b1da | ||
|
|
fc32c521f1 | ||
|
|
126ac36d04 | ||
|
|
f91c7a64ef | ||
|
|
048d11febc | ||
|
|
aedc3a9f1e |
4
.github/workflows/workflow.yml
vendored
4
.github/workflows/workflow.yml
vendored
@@ -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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flutter-action",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user