From f9ee93eecc3e3c4dcf32218a2f16b21bdb24d3ba Mon Sep 17 00:00:00 2001 From: Morn Date: Fri, 21 Jun 2024 15:28:36 +0800 Subject: [PATCH] feat: add github settings --- .github/ISSUE_TEMPLATE/bug_report.md | 33 +++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++ .github/workflows/build_releases.yml | 105 ++++++++++++++++++++++ .github/workflows/build_web.yml | 65 ++++++++++++++ .github/workflows/coverage_action.yml | 23 +++++ 5 files changed, 246 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/build_releases.yml create mode 100644 .github/workflows/build_web.yml create mode 100644 .github/workflows/coverage_action.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..0a7dc88 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,33 @@ +--- +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. + +**Environment(please complete the following information):** +Please use `flutter doctor -v` to show your flutter environment, and add your `markdown_widget` version too + +**Platform** +Does the problem appear on the **Web** or on the **Mobile**? + +**Source data** +Please provide a minimal source data that can help locating the problem \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11fc491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/.github/workflows/build_releases.yml b/.github/workflows/build_releases.yml new file mode 100644 index 0000000..fcdf078 --- /dev/null +++ b/.github/workflows/build_releases.yml @@ -0,0 +1,105 @@ +name: Flutter CI + +on: + push: + branches: + - main + +jobs: + build-and-release-linux: + runs-on: ubuntu-22.04 + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + architecture: x64 + flutter-version: '3.16.5' + - name: Install dependencies + run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-0 libgtk-3-dev libblkid1 liblzma5 + - name: Install project dependencies + run: flutter pub get + - name: Generate intermediates + run: flutter pub run build_runner build --delete-conflicting-outputs + - name: Enable linux build + run: flutter config --enable-linux-desktop + - name: Build artifacts + run: flutter build linux --release + - name: Archive Release + uses: thedoctor0/zip-release@master + with: + type: 'zip' + filename: markdown-${{github.ref_name}}-linux.zip + directory: build/linux/x64/release/bundle + - name: Linux Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} + with: + files: build/linux/x64/release/bundle/markdown-${{github.ref_name}}-linux.zip + + build-and-release-windows: + runs-on: windows-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + architecture: x64 + flutter-version: '3.16.5' + - name: Install project dependencies + run: flutter pub get + - name: Generate intermediates + run: flutter pub run build_runner build --delete-conflicting-outputs + - name: Enable windows build + run: flutter config --enable-windows-desktop + - name: Build artifacts + run: flutter build windows --release + - name: Archive Release + uses: thedoctor0/zip-release@master + with: + type: 'zip' + filename: markdown-${{github.ref_name}}-windows.zip + directory: build/windows/runner/Release + - name: Windows Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} + with: + files: build/windows/runner/Release/markdown-${{github.ref_name}}-windows.zip + + build-and-release-macos: + runs-on: macos-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + architecture: x64 + flutter-version: '3.16.5' + - name: Install project dependencies + run: flutter pub get + - name: Generate intermediates + run: flutter pub run build_runner build --delete-conflicting-outputs + - name: Enable macOS build + run: flutter config --enable-macos-desktop + - name: Build artifacts + run: flutter build macos --release + - name: Archive Release + uses: thedoctor0/zip-release@master + with: + type: 'zip' + filename: markdown-${{github.ref_name}}-macos.zip + directory: build/macos/Build/Products/Release + - name: macOS Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} + with: + files: build/macos/Build/Products/Release/markdown-${{github.ref_name}}-macos.zip \ No newline at end of file diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml new file mode 100644 index 0000000..3ded758 --- /dev/null +++ b/.github/workflows/build_web.yml @@ -0,0 +1,65 @@ +name: Build & deploy + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Flutter + uses: subosito/flutter-action@v1 + with: + channel: 'stable' + flutter-version: '3.16.5' + + + - name: Get dependencies + run: flutter pub get + + - name: Test project + run: flutter test + + - name: Build release project + run: flutter build web + + - name: Show dir + run: ls && cd example && ls + + - name: Download medias + run: dart run build_script/script_convert_asset.dart + + - name: Upload production-ready build files + uses: actions/upload-artifact@v2 + with: + name: production-files + path: build/web + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/dev' + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: production-files + path: build/web + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.ACTION_TOKEN }} + publish_dir: build/web diff --git a/.github/workflows/coverage_action.yml b/.github/workflows/coverage_action.yml new file mode 100644 index 0000000..9f120e1 --- /dev/null +++ b/.github/workflows/coverage_action.yml @@ -0,0 +1,23 @@ +name: Test Coveralls + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + flutter-version: '3.16.5' + - run: flutter pub get + - run: flutter packages pub run build_runner build + - run: flutter test --coverage ./test/ + - uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage/lcov.info \ No newline at end of file