Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f95a8c953b | ||
|
|
3dae472464 | ||
|
|
523b0faa40 | ||
|
|
813937b170 | ||
|
|
8af4ab61aa |
19
.github/workflows/workflow.yml
vendored
19
.github/workflows/workflow.yml
vendored
@@ -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
|
||||||
|
|||||||
55
README.md
55
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 }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: subosito/flutter-action@v2
|
- uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
flutter-version: '1.20.2'
|
channel: beta
|
||||||
channel: 'beta'
|
- run: |
|
||||||
- run: dart --version
|
sudo apt-get update -y
|
||||||
- run: flutter --version
|
sudo apt-get install -y ninja-build libgtk-3-dev
|
||||||
|
- run: flutter config --enable-linux-desktop
|
||||||
|
- run: flutter build linux
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
||||||
```
|
```
|
||||||
|
|||||||
22
setup.sh
22
setup.sh
@@ -64,9 +64,18 @@ download_archive() {
|
|||||||
CHANNEL="$1"
|
CHANNEL="$1"
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
|
|
||||||
if [[ $CHANNEL == master ]]; then
|
if [[ $OS_NAME == windows ]]; then
|
||||||
git clone -b master https://github.com/flutter/flutter.git "$RUNNER_TOOL_CACHE/flutter"
|
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter"
|
||||||
|
PUB_CACHE="${USERPROFILE}\\.pub-cache"
|
||||||
else
|
else
|
||||||
|
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}/flutter"
|
||||||
|
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)
|
VERSION_MANIFEST=$(get_version_manifest $CHANNEL $VERSION)
|
||||||
|
|
||||||
if [[ $VERSION_MANIFEST == null ]]; then
|
if [[ $VERSION_MANIFEST == null ]]; then
|
||||||
@@ -76,14 +85,7 @@ else
|
|||||||
|
|
||||||
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive')
|
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive')
|
||||||
download_archive "$ARCHIVE_PATH" "$RUNNER_TOOL_CACHE"
|
download_archive "$ARCHIVE_PATH" "$RUNNER_TOOL_CACHE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $OS_NAME == windows ]]; then
|
|
||||||
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter"
|
|
||||||
PUB_CACHE="${USERPROFILE}\\.pub-cache"
|
|
||||||
else
|
|
||||||
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}/flutter"
|
|
||||||
PUB_CACHE="${HOME}/.pub-cache"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "FLUTTER_ROOT=${FLUTTER_ROOT}" >>$GITHUB_ENV
|
echo "FLUTTER_ROOT=${FLUTTER_ROOT}" >>$GITHUB_ENV
|
||||||
|
|||||||
Reference in New Issue
Block a user