Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f95a8c953b | ||
|
|
3dae472464 | ||
|
|
523b0faa40 | ||
|
|
813937b170 | ||
|
|
8af4ab61aa | ||
|
|
59a5481c7d |
23
.github/workflows/workflow.yml
vendored
23
.github/workflows/workflow.yml
vendored
@@ -16,9 +16,9 @@ jobs:
|
|||||||
- name: Print FLUTTER_ROOT
|
- name: Print FLUTTER_ROOT
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "FLUTTER_ROOT set to $FLUTTER_ROOT"
|
run: echo "FLUTTER_ROOT set to $FLUTTER_ROOT"
|
||||||
- name: Print PUBCACHE
|
- name: Print PUB_CACHE
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "PUBCACHE set to $PUBCACHE"
|
run: echo "PUB_CACHE set to $PUB_CACHE"
|
||||||
- name: Run dart --version
|
- name: Run dart --version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: dart --version
|
run: dart --version
|
||||||
@@ -72,3 +72,22 @@ jobs:
|
|||||||
- name: Run flutter --version
|
- name: Run flutter --version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: flutter --version
|
run: flutter --version
|
||||||
|
test_with_cache:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ runner.tool_cache }}/flutter
|
||||||
|
key: flutter-2.5.0-stable
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
channel: stable
|
||||||
|
flutter-version: 2.5.0
|
||||||
|
- name: Run dart --version
|
||||||
|
shell: bash
|
||||||
|
run: dart --version
|
||||||
|
- name: Run flutter --version
|
||||||
|
shell: bash
|
||||||
|
run: flutter --version
|
||||||
|
|||||||
63
README.md
63
README.md
@@ -1,8 +1,8 @@
|
|||||||
# flutter-action
|
# flutter-action
|
||||||
|
|
||||||
This action sets up a flutter environment for use in actions. It works on Linux, Windows, and macOS.
|
Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
|
||||||
|
|
||||||
# Usage
|
## Usage
|
||||||
|
|
||||||
Use specific version and channel:
|
Use specific version and channel:
|
||||||
|
|
||||||
@@ -113,22 +113,51 @@ jobs:
|
|||||||
- run: flutter build windows
|
- run: flutter build windows
|
||||||
```
|
```
|
||||||
|
|
||||||
Matrix Testing:
|
Build for Linux desktop:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
build:
|
||||||
name: Test on ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
runs-on: ${{ matrix.os }}
|
steps:
|
||||||
strategy:
|
- uses: actions/checkout@v2
|
||||||
matrix:
|
- uses: subosito/flutter-action@v2
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
with:
|
||||||
steps:
|
channel: beta
|
||||||
- uses: actions/checkout@v2
|
- run: |
|
||||||
- uses: subosito/flutter-action@v2
|
sudo apt-get update -y
|
||||||
with:
|
sudo apt-get install -y ninja-build libgtk-3-dev
|
||||||
flutter-version: '1.20.2'
|
- run: flutter config --enable-linux-desktop
|
||||||
channel: 'beta'
|
- run: flutter build linux
|
||||||
- run: dart --version
|
```
|
||||||
- run: flutter --version
|
|
||||||
|
Build for macOS desktop:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
channel: beta
|
||||||
|
- run: flutter config --enable-macos-desktop
|
||||||
|
- run: flutter build macos
|
||||||
|
```
|
||||||
|
|
||||||
|
Integration with actions/cache:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ runner.tool_cache }}/flutter
|
||||||
|
key: flutter-2.5.0-stable
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
channel: stable
|
||||||
|
flutter-version: 2.5.0
|
||||||
|
- run: flutter --version
|
||||||
```
|
```
|
||||||
|
|||||||
38
setup.sh
38
setup.sh
@@ -64,31 +64,33 @@ download_archive() {
|
|||||||
CHANNEL="$1"
|
CHANNEL="$1"
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
|
|
||||||
if [[ $CHANNEL == master ]]; then
|
|
||||||
git clone -b master https://github.com/flutter/flutter.git "$RUNNER_TOOL_CACHE/flutter"
|
|
||||||
else
|
|
||||||
VERSION_MANIFEST=$(get_version_manifest $CHANNEL $VERSION)
|
|
||||||
|
|
||||||
if [[ $VERSION_MANIFEST == null ]]; then
|
|
||||||
echo "Unable to determine Flutter version for $CHANNEL $VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive')
|
|
||||||
download_archive "$ARCHIVE_PATH" "$RUNNER_TOOL_CACHE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $OS_NAME == windows ]]; then
|
if [[ $OS_NAME == windows ]]; then
|
||||||
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter"
|
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter"
|
||||||
PUBCACHE="${USERPROFILE}\\.pub-cache"
|
PUB_CACHE="${USERPROFILE}\\.pub-cache"
|
||||||
else
|
else
|
||||||
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}/flutter"
|
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}/flutter"
|
||||||
PUBCACHE="${HOME}/.pub-cache"
|
PUB_CACHE="${HOME}/.pub-cache"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -x "${FLUTTER_ROOT}/bin/flutter" ]]; then
|
||||||
|
if [[ $CHANNEL == master ]]; then
|
||||||
|
git clone -b master https://github.com/flutter/flutter.git "$RUNNER_TOOL_CACHE/flutter"
|
||||||
|
else
|
||||||
|
VERSION_MANIFEST=$(get_version_manifest $CHANNEL $VERSION)
|
||||||
|
|
||||||
|
if [[ $VERSION_MANIFEST == null ]]; then
|
||||||
|
echo "Unable to determine Flutter version for $CHANNEL $VERSION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive')
|
||||||
|
download_archive "$ARCHIVE_PATH" "$RUNNER_TOOL_CACHE"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "FLUTTER_ROOT=${FLUTTER_ROOT}" >>$GITHUB_ENV
|
echo "FLUTTER_ROOT=${FLUTTER_ROOT}" >>$GITHUB_ENV
|
||||||
echo "PUB_CACHE=${PUBCACHE}" >>$GITHUB_ENV
|
echo "PUB_CACHE=${PUB_CACHE}" >>$GITHUB_ENV
|
||||||
|
|
||||||
echo "${FLUTTER_ROOT}/bin" >>$GITHUB_PATH
|
echo "${FLUTTER_ROOT}/bin" >>$GITHUB_PATH
|
||||||
echo "${FLUTTER_ROOT}/bin/cache/dart-sdk/bin" >>$GITHUB_PATH
|
echo "${FLUTTER_ROOT}/bin/cache/dart-sdk/bin" >>$GITHUB_PATH
|
||||||
echo "${PUBCACHE}/bin" >>$GITHUB_PATH
|
echo "${PUB_CACHE}/bin" >>$GITHUB_PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user