Skip to content

add workflows and examples, fix macos test, make enableVisibility def… #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.27.3"
"flutter": "master"
}
15 changes: 15 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: rainyl
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: ['https://afdian.com/a/rainyl', 'https://paypal.me/rainyliu']
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. Windows 10]

**Smartphone (please complete the following information):**
- Device: [e.g. Android 11]
- ABI Version [e.g. arm64-v8a]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Question
about: Ask a Question
title: ''
labels: question
assignees: ''

---

**Read README carefully first**
**Star :star: this project if you want to ask a question, no star, no answer**

## Question
Describe the question here
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pub"
directories:
- "/"

schedule:
interval: "weekly"
108 changes: 108 additions & 0 deletions .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Example
on:
push:
paths-ignore:
- "**.md"
- "LICENSE"

jobs:
windows:
name: windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: run dart-cli example
run: |
cd ${{github.workspace}}\example\dart_cli
dart --enable-experiment=native-assets run
- name: run flutter example
run: |
cd ${{github.workspace}}\example\flutter
flutter config --enable-native-assets
flutter build windows --release
linux:
name: linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf gcc-i686-linux-gnu \
gcc-riscv64-linux-gnu ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: run dart-cli example
run: |
cd "${{github.workspace}}/example/dart_cli"
dart --enable-experiment=native-assets run
- name: run flutter example
run: |
cd "${{github.workspace}}/example/flutter"
flutter config --enable-native-assets
flutter build linux --release
macos:
name: macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: run dart-cli example
run: |
cd "${{github.workspace}}/example/dart_cli"
dart --enable-experiment=native-assets run
- name: run flutter example
run: |
cd "${{github.workspace}}/example/flutter"
flutter config --enable-native-assets
flutter build macos --release
ios:
name: ios
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: flutter example
run: |
cd "${{github.workspace}}/example/flutter"
flutter config --enable-native-assets
flutter build ios --release --no-codesign
android:
name: android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf gcc-i686-linux-gnu \
gcc-riscv64-linux-gnu ninja-build
- uses: subosito/flutter-action@v2
with:
channel: "master"
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r27c
add-to-path: true
- name: flutter example
run: |
cd "${{github.workspace}}/example/flutter"
flutter config --enable-native-assets
flutter build apk --release
24 changes: 24 additions & 0 deletions .github/workflows/formatter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:

name: Format Code

jobs:
build:
name: format code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: "master"
- name: Format code
run: |
dart format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "dart format ✅"
branch: ${{ github.head_ref }}
98 changes: 98 additions & 0 deletions .github/workflows/test_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: test publish to pub.dev and release

on:
push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+*' # tag pattern on pub.dev: 'v{{version}'

jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf gcc-i686-linux-gnu \
gcc-riscv64-linux-gnu ninja-build
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r27c
add-to-path: true
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: test
run: |
cd "${{github.workspace}}"
dart test
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: setup
run: |
choco install ninja
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r27c
add-to-path: true
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: test
run: |
cd "${{github.workspace}}"
dart test
test-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: setup
run: |
brew install ninja
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r27c
add-to-path: true
- uses: subosito/flutter-action@v2
with:
channel: "master"
- name: test
run: |
cd "${{github.workspace}}"
dart test
publish:
name: Publish
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-linux, test-windows, test-macos]
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest
environment: pub.dev
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: dart pub get
- name: Publish
run: dart pub publish --force

release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-linux, test-windows, test-macos, publish]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: release
uses: softprops/action-gh-release@v1
with:
draft: false
prerelease: false
generate_release_notes: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# See https://www.dartlang.org/guides/libraries/private-files

# custom
.bak/

# Files and directories created by pub
.dart_tool/
.packages
Expand Down Expand Up @@ -29,4 +32,4 @@ doc/api/
.flutter-plugins-dependencies

# FVM Version Cache
.fvm/
.fvm/
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.27.3"
"dart.flutterSdkPath": ".fvm/versions/master",
"dart.vmAdditionalArgs": [
"--enable-experiment=native-assets"
]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ Refer to [example](https://github.com/rainyl/native_toolchain_cmake/tree/main/ex
## Acknowledgements

- [native_toolchain_c](https://pub.dev/packages/native_toolchain_c)

## License

Apache-2.0 License
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ analyzer:
non_constant_identifier_names: ignore
parameter_assignments: error
prefer_if_elements_to_conditional_expressions: ignore
formatter:
pagewidth: 110
linter:
rules:
- always_declare_return_types
Expand Down
3 changes: 3 additions & 0 deletions example/add/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# native_toolchain_cmake demo libadd

this is an example showing how to use the native_toolchain_cmake package
5 changes: 5 additions & 0 deletions example/add/bin/add.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:add/add.dart';

void main() {
print(calculate(7, 7, times: 3));
}
Loading