From 7c4f86d048c955c6cd7555efa0c959758348fd1c Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Thu, 17 Aug 2023 13:46:36 -0600 Subject: [PATCH] Add lint workflow and a purposeful screw up --- .gitea/workflows/lint.yml | 106 ++++++++++++++++++++++++++++++++++++++ lib/main.dart | 1 + 2 files changed, 107 insertions(+) create mode 100644 .gitea/workflows/lint.yml diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..f234c46 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -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 \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 1c243a6..bc00080 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,6 +15,7 @@ import 'global/api.dart'; import 'global/widgets/ui_button.dart'; void main() async { + final thing; // await Api().loadToken(); runApp(const ProviderScope(child: MyApp())); }