feat: migrate to apimock api #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Merge CI | |
# This workflow is triggered on pull request to the repository. | |
# Run this script when PR and status is closed | |
on: | |
pull_request: | |
types: [ closed ] | |
jobs: | |
build: | |
# This job will run on ubuntu virtual machine | |
runs-on: ubuntu-latest | |
steps: | |
# Setup Java environment in order to build the Android app. | |
- uses: actions/checkout@v4.2.1 | |
- uses: actions/setup-java@v4.3.0 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '17' | |
# Setup the flutter environment. | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' # 'dev', 'alpha', default to: 'stable' | |
# flutter-version: '1.12.x' # you can also specify exact version of flutter | |
# Get flutter dependencies. | |
- name: Running flutter pub get | |
run: flutter pub get | |
# Formatting code | |
- name: Running flutter format | |
run: dart format lib/ | |
# Get current branch | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v5 | |
# Check modified files | |
- name: Check for modified files | |
id: git-check | |
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | |
# Push code changes | |
- name: Push changes | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Lzyct-Bot' | |
git config --global user.email 'lazycatlabs@users.noreply.github.com' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git fetch | |
git checkout ${{ steps.branch-name.outputs.current_branch }} | |
git commit -am "clean: apply formatting changes" | |
git push | |
# Run widget tests for our flutter project. | |
- name: Run flutter test --machine --coverage | |
run: flutter test --machine --coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # Add this secret in your repository settings | |
file: coverage/lcov.info | |
# Build apk. | |
# - name: Build apk file | |
# run: flutter build apk --flavor stg -t lib/main_stg.dart | |
# | |
# # Upload generated apk to the artifacts. | |
# - name: Uploading apk file | |
# uses: actions/upload-artifact@v1 | |
# with: | |
# name: staging-apk | |
# path: build/app/outputs/flutter-apk/app-stg-release.apk | |
- name: Delete branch if merged | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `heads/${context.payload.pull_request.head.ref}`, | |
}) |