rluv_client/.gitea/workflows/lint.yml

108 lines
3.7 KiB
YAML
Raw Normal View History

name: Lint Code
on:
pull_request:
branches: [ "master" ]
jobs:
lint-mobile:
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.filter.outputs.workflows }}
name: 'Lint Flutter Mobile'
steps:
- uses: actions/checkout@v3
# - uses: dorny/paths-filter@v2
# id: filter
# with:
# list-files: shell
# filters: |
# mobile:
# - added|modified: 'mobile/**'
- name: Install Deps
run: |
apt-get update
apt-get --yes --force-yes install jq unzip
- name: Install Flutter SDK and Lint
# if: steps.filter.outputs.mobile == 'true'
run: |
echo 'Downloading sdk...'
cd ..
git clone -b stable --single-branch https://github.com/flutter/flutter.git
echo 'Adding flutter to path:'
export PATH="$PATH:`pwd`/flutter/bin"
cd rluv-client
flutter doctor
echo 'Generating model files...'
dart run build_runner build
echo 'Analyzing...'
flutter analyze --no-fatal-infos --no-fatal-warnings > mobile_lint.txt
export MOBILE=$(cat mobile_lint.txt | grep -o 'No issues found' | wc -l | xargs)
if [[ $MOBILE == 0 ]]; then echo 'Flutter Linting failed with' && cat mobile_lint.txt | tail -n 15 && echo '...' && exit 1; fi
# lint-busypay:
# runs-on: ubuntu-latest
# outputs:
# output1: ${{ steps.filter.outputs.workflows }}
# name: 'Lint Flutter Busypay'
# steps:
# - uses: actions/checkout@v3
# - uses: dorny/paths-filter@v2
# id: filter
# with:
# list-files: shell
# filters: |
# busypay:
# - added|modified: 'busypay/lib/**'
# - name: Install Flutter SDK
# if: steps.filter.outputs.busypay == 'true'
# uses: subosito/flutter-action@v2
# with:
# flutter-version: '3.0.2'
# channel: 'stable'
# - name: Lint BusyPay Flutter Files
# if: steps.filter.outputs.busypay == 'true'
# run: |
# echo 'Analyzing flutter files'
# cd busypay
# flutter pub get
# cd ..
# flutter analyze --no-fatal-infos --no-fatal-warnings ${{ steps.filter.outputs.busypay_files }} > busypay_lint.txt
# export BUSYPAY=$(cat busypay_lint.txt | grep -o 'No issues found' | wc -l | xargs)
# if [[ $BUSYPAY == 0 ]]; then echo 'Flutter Linting failed with' && cat busypay_lint.txt | tail -n 15 && echo '...' && exit 1; fi
# lint-api:
# runs-on: ubuntu-latest
# outputs:
# output1: ${{ steps.filter.outputs.workflows }}
# name: 'Lint API'
# steps:
# - uses: actions/checkout@v3
# - uses: dorny/paths-filter@v2
# id: filter
# with:
# list-files: shell
# filters: |
# api:
# - added|modified: 'api/**/*.rb'
# # Run only if .rb files in api were modified
# - name: Install Ruby
# if: steps.filter.outputs.api == 'true'
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: '2.6'
# #bundler-cache: true # runs 'bundle install' and caches installed gems automatically
# working-directory: 'api/'
# - name: Lint API
# if: steps.filter.outputs.api == 'true' # sudo apt-get -yqq install libpq-dev
# run: |
# echo 'Installing rubocop gem'
# export PATH=$RUBY_PATH:$PATH
# gem install rubocop
# rubocop -v
# rubocop --fail-level=E ${{ steps.filter.outputs.api_files }} > api_lint.txt
# export API=$(cat api_lint.txt | grep -o 'no offenses' | wc -l | xargs)
# if [[ $API == 0 ]]; then echo 'API Linting failed with' && cat api_lint.txt | tail -n 15 && echo '...' && exit 1; fi
# env:
# RUBY_PATH: /home/runner/.gem/ruby/2.6.0/bin