git@yoqi.me 9 months ago
parent
commit
c997c71db9
3 changed files with 107 additions and 0 deletions
  1. 1 0
      .devcontainer/Dockerfile
  2. 45 0
      .devcontainer/devcontainer.json
  3. 61 0
      .github/workflows/build.yml

+ 1 - 0
.devcontainer/Dockerfile

@@ -0,0 +1 @@
+FROM jianboy/flutter-dev-container:3.7.7

+ 45 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,45 @@
+// java8 + android env
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/java-8
+{
+    "name": "Java 8",
+    "build": {
+        "dockerfile": "Dockerfile",
+        "args": {
+            // Use the VARIANT arg to pick a Debian OS version: buster, bullseye
+            // Use bullseye when running on local arm64/Apple Silicon.
+            "VARIANT": "buster",
+            // Options
+            "INSTALL_MAVEN": "true",
+            "INSTALL_GRADLE": "true",
+            "NODE_VERSION": "lts/*"
+        }
+    },
+    // Set *default* container specific settings.json values on container create.
+    "settings": {
+        "java.home": "/docker-java-home",
+        "java.import.gradle.java.home": "/usr/local/sdkman/candidates/java/current",
+        "java.configuration.runtimes": [
+            {
+                "default": true,
+                "name": "JavaSE-1.8",
+                "path": "/usr/local/sdkman/candidates/java/current"
+            }
+        ]
+    },
+    // Add the IDs of extensions you want installed when the container is created.
+    "extensions": [
+        "vscjava.vscode-java-pack",
+        "dart-code.dart-code",
+        "dart-code.flutter"
+    ],
+    // Use 'forwardPorts' to make a list of ports inside the container available locally.
+    // "forwardPorts": [],
+    // Use 'postCreateCommand' to run commands after the container is created.
+    // "postCreateCommand": "java -version",
+    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+    "remoteUser": "vscode",
+    "features": {
+        "docker-in-docker": "latest"
+    }
+}

+ 61 - 0
.github/workflows/build.yml

@@ -0,0 +1,61 @@
+name: CI
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+jobs:
+  build:
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+    runs-on: ${{matrix.os}}
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Setup Java JDK
+        uses: actions/setup-java@v2
+        with:
+          distribution: 'adopt'
+          java-version: "8.x"
+
+      - name: Flutter action
+        uses: subosito/flutter-action@v1.5.3
+        with:
+          channel: "stable"
+          flutter-version: "3.7.7"
+
+      - name: Cache Dependencies
+        id: cache
+        uses: actions/cache@v2
+        with:
+          path: |
+            ~/.gradle/caches
+            ~/.gradle/wrapper
+            Pods
+          key: |
+            ${{runner.OS}}-gradle-caches-${{ hashFiles('pubspec.lock') }}
+            ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-pods-
+            ${{ runner.os }}-gradle-
+
+      - name: Install Dependencies
+        if: steps.cache.outputs.cache-hit != 'true'
+        run: flutter pub get
+
+      - name: Build apk
+        if: ${{ runner.os == 'Linux' }}
+        run: flutter build apk --debug --no-sound-null-safety
+
+      # output some file:
+      - name: artifact
+        uses: actions/upload-artifact@v2
+        with:
+          name: ${{runner.OS}}-artifact
+          path: |
+            # build/app/outputs/flutter-apk/**/*.apk
+            build/app/outputs/flutter-apk/app.apk
+            build/ios/**/*.ipa
+            build/web/web-app.zip
+            build/windows/runner/Release/