Merge pull request 'Add lint workflow and a purposeful screw up' (#1) from new-stuff into master

Reviewed-on: tom/rluv-client#1
This commit is contained in:
Tom Cat 2023-08-17 13:48:52 -06:00
commit a84844a314
2 changed files with 107 additions and 0 deletions

106
.gitea/workflows/lint.yml Normal file
View File

@ -0,0 +1,106 @@
name: Lint Code
on:
push:
branches: [ "master" ]
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 Flutter SDK
# if: steps.filter.outputs.mobile == 'true'
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.6'
channel: 'stable'
- name: Lint Mobile Flutter Files
# if: steps.filter.outputs.mobile == 'true'
run: |
echo 'Analyzing flutter files'
flutter pub get
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

View File

@ -15,6 +15,7 @@ import 'global/api.dart';
import 'global/widgets/ui_button.dart'; import 'global/widgets/ui_button.dart';
void main() async { void main() async {
final thing;
// await Api().loadToken(); // await Api().loadToken();
runApp(const ProviderScope(child: MyApp())); runApp(const ProviderScope(child: MyApp()));
} }