Skip to content

Commit

Permalink
chore: Improve CI (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky authored Dec 1, 2024
1 parent 3ea9129 commit b064b20
Show file tree
Hide file tree
Showing 175 changed files with 3,880 additions and 4,768 deletions.
30 changes: 30 additions & 0 deletions .github/validate-formatting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
if [[ $(git ls-files --modified) ]]; then
echo ""
echo ""
echo "These files are not formatted correctly:"
for f in $(git ls-files --modified); do
echo ""
echo ""
echo "-----------------------------------------------------------------"
echo "$f"
echo "-----------------------------------------------------------------"
echo ""
git --no-pager diff --unified=0 --minimal $f
echo ""
echo "-----------------------------------------------------------------"
echo ""
echo ""
done
if [[ $GITHUB_WORKFLOW ]]; then
git checkout . > /dev/null 2>&1
fi
echo ""
echo "❌ Some files are incorrectly formatted, see above output."
echo ""
echo "To fix these locally, run: 'melos run format'."
exit 1
else
echo ""
echo "✅ All files are formatted correctly."
fi
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.19.5
version: 3.24.3
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand All @@ -30,7 +30,7 @@ jobs:
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.19.5
version: 3.24.3
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.19.5
version: 3.24.3
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.19.5
version: 3.24.3
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
- name: Run scarb check
if: steps.changes.outputs.contracts_dir == 'true'
run: melos test:dart:unit
run: melos test:dart:unit
88 changes: 88 additions & 0 deletions .github/workflows/code_health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: code_health

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
push:
branches:
- main
paths-ignore:
- "docs/**"
- "**.md"

jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@v3
- name: "Run Analyze"
run: melos run analyze

pub_dry_run:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@v3
- name: "Pub Check"
run: |
melos exec -c 1 --no-private --ignore="*example*" -- \
dart pub publish --dry-run
pub_get_check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@v3
- name: "flutter pub get"
run: |
melos exec -c 1 --scope="*example*" -- \
"flutter pub get"
# format:
# runs-on: macos-latest
# steps:
# - uses: actions/[email protected]
# - uses: subosito/flutter-action@v2
# with:
# channel: "stable"
# cache: true
# - uses: bluefireteam/melos-action@v3
# - uses: Homebrew/actions/setup-homebrew@master
# - name: "Install Tools"
# run: |
# flutter pub global activate flutter_plugin_tools
# brew install swiftformat
# brew install clang-format
# brew link --overwrite --force clang-format
# - name: "Formatter version"
# run: |
# clang-format --version
# swiftformat --version
# - name: "Dart, Java and Objective-C "
# run: |
# flutter pub global run flutter_plugin_tools format
# ./.github/validate-formatting.sh
# - name: "Swift"
# if: ${{ success() || failure() }}
# run: |
# swiftformat .
# ./.github/validate-formatting.sh
20 changes: 20 additions & 0 deletions .github/workflows/pr_title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: pr_title

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions: read-all

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
validate:
name: PR title validation
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ coverage/
# deploy for test
.starkli/account_1.json
pubspec_overrides.yaml
*.iml
6 changes: 6 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--indent 2
--maxwidth 100
--wrapparameters afterfirst
--disable sortedImports,unusedArguments,wrapMultilineStatementBraces
--exclude Pods,**/MainFlutterWindow.swift,**/AppDelegate.swift,**/.symlinks/**
--swiftversion 5.7
8 changes: 8 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include: package:starklints/lints.yaml

analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
errors:
invalid_annotation_target: ignore
1 change: 1 addition & 0 deletions examples/nft_marketplace/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
pubspec_overrides.yaml
16 changes: 8 additions & 8 deletions examples/nft_marketplace/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import UIKit
import Flutter
import UIKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
2 changes: 0 additions & 2 deletions examples/nft_marketplace/ios/RunnerTests/RunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import UIKit
import XCTest

class RunnerTests: XCTestCase {

func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}

}
6 changes: 3 additions & 3 deletions examples/nft_marketplace/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FlutterMacOS

@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
override func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool {
return true
}
}
16 changes: 8 additions & 8 deletions examples/nft_marketplace/macos/Runner/MainFlutterWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import Cocoa
import FlutterMacOS

class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
let windowFrame = self.frame
self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true)
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
let windowFrame = frame
contentViewController = flutterViewController
setFrame(windowFrame, display: true)

RegisterGeneratedPlugins(registry: flutterViewController)
RegisterGeneratedPlugins(registry: flutterViewController)

super.awakeFromNib()
}
super.awakeFromNib()
}
}
4 changes: 1 addition & 3 deletions examples/nft_marketplace/macos/RunnerTests/RunnerTests.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import FlutterMacOS
import Cocoa
import FlutterMacOS
import XCTest

class RunnerTests: XCTestCase {

func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}

}
10 changes: 5 additions & 5 deletions examples/nft_marketplace/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ environment:
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
ark_project:
starknet:
starknet_provider:
secure_store:
wallet_kit:
ark_project: ^0.1.0
starknet: ^0.1.0
starknet_provider: ^0.1.0
secure_store: ^0.1.2
wallet_kit: ^0.0.1

flutter:
sdk: flutter
Expand Down
4 changes: 3 additions & 1 deletion examples/nft_marketplace/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: ark_project,secure_store,starknet,starknet_provider
# melos_managed_dependency_overrides: ark_project,secure_store,starknet,starknet_provider,wallet_kit
dependency_overrides:
ark_project:
path: ../../packages/ark_project
Expand All @@ -8,3 +8,5 @@ dependency_overrides:
path: ../../packages/starknet
starknet_provider:
path: ../../packages/starknet_provider
wallet_kit:
path: ../../packages/wallet_kit
4 changes: 2 additions & 2 deletions examples/starknet_cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ environment:
sdk: ^3.0.0

dependencies:
starknet:
starknet_provider:
starknet: ^0.1.0
starknet_provider: ^0.1.0
args: ^2.4.2
csv: ^5.1.1

Expand Down
16 changes: 8 additions & 8 deletions examples/starknet_counter/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import UIKit
import Flutter
import UIKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
2 changes: 0 additions & 2 deletions examples/starknet_counter/ios/RunnerTests/RunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import UIKit
import XCTest

class RunnerTests: XCTestCase {

func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}

}
Loading

0 comments on commit b064b20

Please sign in to comment.