Skip to content

test

test #57

Workflow file for this run

name: Dart Tests
on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
# optional parameters follow
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: Install dependencies
run: flutter pub get
- name: Prepare env file
run: cp .env.sample .env
- name: Run tests
run: flutter test --coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
prepare-release:
runs-on: ubuntu-latest
if: startsWith(github.ref_name, 'release-v')
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Extract version from branch
id: extract_version
run: |
branch_name="${{ github.ref_name }}"
version="${branch_name#release-v}"
echo "version=v$version" >> $GITHUB_ENV
- name: Generate Changelog
run: |
git cliff --tag ${{ env.version }} --output CHANGELOG.md
git add CHANGELOG.md
git commit -m "chore: update CHANGELOG for version ${{ env.version }}"
git push origin ${{ github.ref_name }}
- name: Update version in pubspec.yaml
run: |
version_line=$(grep "^version:" pubspec.yaml)
sed -i "s/$version_line/version: ${{ env.version }}/" pubspec.yaml
git add pubspec.yaml
git commit -m "chore: update pubspec.yaml version to ${{ env.version }}"
git push origin ${{ github.ref_name }}