165 lines
4 KiB
YAML
165 lines
4 KiB
YAML
name: Web App CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
paths:
|
|
- 'mnemo_cards_web_v2/**'
|
|
- 'mnemo_cards_common/**'
|
|
- 'mnemo_cards_frontend_common/**'
|
|
- 'chat/mnemo_cards_chat/**'
|
|
- 'games/packages/**'
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
paths:
|
|
- 'mnemo_cards_web_v2/**'
|
|
- 'mnemo_cards_common/**'
|
|
- 'mnemo_cards_frontend_common/**'
|
|
- 'chat/mnemo_cards_chat/**'
|
|
- 'games/packages/**'
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Git
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y git
|
|
git --version
|
|
git config --global --add safe.directory '*'
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.35.5'
|
|
channel: 'stable'
|
|
cache: false
|
|
git-path: /usr/bin/git
|
|
|
|
- name: Cache Flutter dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.pub-cache
|
|
mnemo_cards_web_v2/.dart_tool
|
|
mnemo_cards_common/.dart_tool
|
|
mnemo_cards_frontend_common/.dart_tool
|
|
chat/mnemo_cards_chat/.dart_tool
|
|
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-flutter-
|
|
|
|
- name: Install common dependencies
|
|
run: |
|
|
cd mnemo_cards_common
|
|
flutter pub get
|
|
|
|
- name: Install frontend common dependencies
|
|
run: |
|
|
cd mnemo_cards_frontend_common
|
|
flutter pub get
|
|
|
|
- name: Install chat dependencies
|
|
run: |
|
|
cd chat/mnemo_cards_chat
|
|
flutter pub get
|
|
|
|
- name: Install web app dependencies
|
|
run: |
|
|
cd mnemo_cards_web_v2
|
|
flutter pub get
|
|
|
|
- name: Run code generation
|
|
run: |
|
|
cd mnemo_cards_web_v2
|
|
flutter pub run build_runner build --delete-conflicting-outputs
|
|
|
|
- name: Run linting
|
|
run: |
|
|
cd mnemo_cards_web_v2
|
|
flutter analyze lib/
|
|
flutter format --set-exit-if-changed lib/
|
|
|
|
- name: Run tests
|
|
run: |
|
|
cd mnemo_cards_web_v2
|
|
flutter test --coverage
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
file: ./mnemo_cards_web_v2/coverage/lcov.info
|
|
flags: web
|
|
name: web-coverage
|
|
|
|
build:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Git
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y git
|
|
git --version
|
|
git config --global --add safe.directory '*'
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.35.5'
|
|
channel: 'stable'
|
|
cache: true
|
|
git-path: /usr/bin/git
|
|
|
|
- name: Cache Flutter dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.pub-cache
|
|
mnemo_cards_web_v2/.dart_tool
|
|
mnemo_cards_common/.dart_tool
|
|
mnemo_cards_frontend_common/.dart_tool
|
|
chat/mnemo_cards_chat/.dart_tool
|
|
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-flutter-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
cd mnemo_cards_common
|
|
flutter pub get
|
|
cd ../mnemo_cards_frontend_common
|
|
flutter pub get
|
|
cd ../chat/mnemo_cards_chat
|
|
flutter pub get
|
|
cd ../../mnemo_cards_web_v2
|
|
flutter pub get
|
|
|
|
- name: Run code generation
|
|
run: |
|
|
cd mnemo_cards_web_v2
|
|
flutter pub run build_runner build --delete-conflicting-outputs
|
|
|
|
- name: Build web app
|
|
run: |
|
|
cd mnemo_cards_web_v2
|
|
flutter build web --release --dart-define=API_BASE_URL=https://api.mnemo-cards.online
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web-build
|
|
path: mnemo_cards_web_v2/build/web/
|