update CI. (#287)

* update.

* update.

* pub update.

* fix import_sorter.

* fix analyze.
This commit is contained in:
CloudWebRTC
2023-05-17 13:44:28 +08:00
committed by GitHub
parent 83f87547e7
commit e12dd60f5f
20 changed files with 179 additions and 61 deletions
+119 -24
View File
@@ -7,35 +7,130 @@ on:
branches: [ main ]
jobs:
build:
# This job will run on ubuntu virtual machine
dart-format-and-analyze-check:
name: Dart Format Check
runs-on: ubuntu-latest
steps:
# # Setup Java environment in order to build the Android app.
# - uses: actions/checkout@v1
# - uses: actions/setup-java@v1
# with:
# java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
- uses: actions/checkout@v2
- name: Cache Flutter dependencies
uses: actions/cache@v1
- uses: actions/setup-java@v1
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }}
java-version: '12.x'
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Dart Format Check
run: dart format lib/ test/ --set-exit-if-changed
- name: Import Sorter Check
run: dart run import_sorter:main --no-comments --exit-if-changed
- name: Dart Analyze Check
run: flutter analyze
- name: Dart Test Check
run: flutter test
# Get flutter dependencies.
- run: flutter pub get
build-for-android:
name: Build for Flutter Android
runs-on: ubuntu-latest
# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Start Android Build
working-directory: ./example
run: flutter build apk
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
build-for-ios:
name: Build for Flutter iOS
runs-on: macos-latest
# Run widget tests for our flutter project.
- run: flutter test
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Build for iOS
working-directory: ./example
run: flutter build ios --release --no-codesign
build-for-windows:
name: Build for flutter Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Build for windows
working-directory: ./example
run: flutter build windows --release
build-for-macos:
name: Build for flutter macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Build for windows
working-directory: ./example
run: flutter build macos --release
build-for-linux:
name: Build for Flutter Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Install ninja-build libgtk-3-dev
run: sudo apt-get install -y ninja-build libgtk-3-dev
- name: Start Linux Build
working-directory: ./example
run: flutter build linux
build-for-web:
name: Build for Flutter Web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install project dependencies
run: flutter pub get
- name: Start Web Build
working-directory: ./example
run: flutter build web
+24 -13
View File
@@ -1,26 +1,37 @@
name: Publish build
on:
push:
# only publish on version tags
tags:
- v*
release:
types: [published]
jobs:
publish:
# This job will run on ubuntu virtual machine
runs-on: ubuntu-latest
steps:
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
- uses: actions/checkout@v2
- name: Cache Flutter dependencies
uses: actions/cache@v1
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }}
flutter-version: '3.3.3'
- name: Install project dependencies
run: flutter pub get
- name: Dart Format Check
run: dart format lib/ test/ --set-exit-if-changed
- name: Import Sorter Check
run: dart run import_sorter:main --no-comments --exit-if-changed
- name: Dart Analyze Check
run: flutter analyze
- name: Dart Test Check
run: flutter test
- name: Check Publish Warnings
run: dart pub publish --dry-run
- name: Publish
uses: k-paxian/[email protected]
with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: true
skipTests: true
force: true
- run: flutter pub get
- run: flutter pub global activate dartdoc