diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..b90f15aa2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,167 @@ +name: build +on: + workflow_dispatch: + inputs: + enable_android: + description: 'Build Android' + required: false + default: true + type: boolean + enable_web: + description: 'Build Web' + required: false + default: true + type: boolean + enable_ios: + description: 'Build IOS' + required: false + default: true + type: boolean + enable_windows: + description: 'Build Windows' + required: false + default: true + type: boolean + enable_linux: + description: 'Build Linux' + required: false + default: true + type: boolean + enable_macos: + description: 'Build MacOS' + required: false + default: true + type: boolean + workflow_call: + inputs: + enable_android: + required: false + default: true + type: boolean + enable_web: + required: false + default: true + type: boolean + enable_ios: + required: false + default: true + type: boolean + enable_windows: + required: false + default: true + type: boolean + enable_linux: + required: false + default: true + type: boolean + enable_macos: + required: false + default: true + type: boolean + +jobs: + web: + runs-on: ubuntu-latest + timeout-minutes: 30 + if: inputs.enable_web + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + - uses: bluefireteam/melos-action@main + + - name: Example app - Build Web app + working-directory: ./packages/audioplayers/example + run: flutter build web + + android: + runs-on: ubuntu-latest + timeout-minutes: 60 + if: inputs.enable_android + steps: + - uses: actions/checkout@v3 + + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - uses: subosito/flutter-action@v2 + - uses: bluefireteam/melos-action@main + + - name: Example App - Build Android APK + working-directory: ./packages/audioplayers/example + run: flutter build apk --release + + - name: Run Android unit tests + working-directory: ./packages/audioplayers/example/android + run: ./gradlew test + + ios: + runs-on: macOS-latest + timeout-minutes: 30 + if: inputs.enable_ios + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + - uses: bluefireteam/melos-action@main + + - name: Example app - Build iOS + working-directory: ./packages/audioplayers/example + run: flutter build ios --release --no-codesign + + macos: + runs-on: macOS-latest + timeout-minutes: 30 + if: inputs.enable_macos + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + - uses: bluefireteam/melos-action@main + + - name: setup-cocoapods + uses: maxim-lobanov/setup-cocoapods@v1 + with: + podfile-path: ./packages/audioplayers/example/macos/Podfile.lock + - name: Example app - Build macOS + working-directory: ./packages/audioplayers/example + run: flutter build macos --release + + windows: + runs-on: windows-latest + timeout-minutes: 30 + if: inputs.enable_windows + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + - uses: bluefireteam/melos-action@main + + - name: Example app - Build Windows app + working-directory: ./packages/audioplayers/example + run: flutter build windows --release + + linux: + runs-on: ubuntu-latest + timeout-minutes: 30 + if: inputs.enable_linux + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + - uses: bluefireteam/melos-action@main + + - name: Install Flutter requirements for Linux + run: | + sudo apt-get update + sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev + - name: Install GStreamer + # Install libunwind-dev, see https://github.com/actions/runner-images/issues/6399#issuecomment-1285011525 + run: | + sudo apt install -y libunwind-dev + sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + + - name: Example app - Build Linux app + working-directory: ./packages/audioplayers/example + run: flutter build linux --release diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..5c8db6b64 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,15 @@ +name: pull-request +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - ready_for_review + +jobs: + call-test: + uses: ./.github/workflows/test.yml + if: github.event.pull_request.draft == false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..dd7de8bf0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,13 @@ +name: release +on: + push: + branches: + - main + +jobs: + call-build: + uses: ./.github/workflows/build.yml + + call-test: + needs: call-build + uses: ./.github/workflows/test.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/test.yml similarity index 76% rename from .github/workflows/build.yaml rename to .github/workflows/test.yml index 79addb43c..b0d34aabd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/test.yml @@ -1,28 +1,72 @@ -name: build +name: test on: - workflow_dispatch: { } - push: - branches: - - main - pull_request: - branches: - - main - types: - - opened - - reopened - - synchronize - - ready_for_review + workflow_dispatch: + inputs: + enable_android: + description: 'Test Android' + required: false + default: true + type: boolean + enable_web: + description: 'Test Web' + required: false + default: true + type: boolean + enable_ios: + description: 'Test IOS' + required: false + default: true + type: boolean + enable_windows: + description: 'Test Windows' + required: false + default: true + type: boolean + enable_linux: + description: 'Test Linux' + required: false + default: true + type: boolean + enable_macos: + description: 'Test MacOS' + required: false + default: true + type: boolean + workflow_call: + inputs: + enable_android: + required: false + default: true + type: boolean + enable_web: + required: false + default: true + type: boolean + enable_ios: + required: false + default: true + type: boolean + enable_windows: + required: false + default: true + type: boolean + enable_linux: + required: false + default: true + type: boolean + enable_macos: + required: false + default: true + type: boolean jobs: - build: + test: runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - run: melos run format-check @@ -32,28 +76,20 @@ jobs: web: runs-on: ubuntu-latest timeout-minutes: 30 - if: github.event.pull_request.draft == false + if: inputs.enable_web steps: - uses: actions/checkout@v3 - - - uses: nanasess/setup-chromedriver@v1 - - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - - - name: Example app - Build Web app - working-directory: ./packages/audioplayers/example - run: | - flutter build web + - uses: nanasess/setup-chromedriver@v1 - name: Run Flutter integration tests working-directory: ./packages/audioplayers/example run: | export DISPLAY=:99 + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + chromedriver --port=4444 & - sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional ( cd server; dart run bin/server.dart ) & flutter drive \ @@ -67,7 +103,7 @@ jobs: android: runs-on: macOS-latest timeout-minutes: 60 - if: github.event.pull_request.draft == false + if: inputs.enable_android steps: - uses: actions/checkout@v3 @@ -81,20 +117,8 @@ jobs: uses: android-actions/setup-android@v2 - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - - name: Example App - Build Android APK - working-directory: ./packages/audioplayers/example - run: | - flutter build apk --release - - - name: Run Android unit tests - working-directory: ./packages/audioplayers/example/android - run: | - ./gradlew test - - name: Download Android emulator image run: | export ANDROID_TOOLS="$ANDROID_HOME/cmdline-tools/latest/bin" @@ -120,12 +144,10 @@ jobs: ios: runs-on: macOS-latest timeout-minutes: 60 - if: github.event.pull_request.draft == false + if: inputs.enable_ios steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - name: List all simulators @@ -136,10 +158,6 @@ jobs: echo "Using simulator $UDID" xcrun simctl boot "${UDID:?No Simulator with this name iPhone found}" - - name: Example app - Build iOS - working-directory: ./packages/audioplayers/example - run: | - flutter build ios --release --no-codesign - name: Run Flutter integration tests working-directory: ./packages/audioplayers/example run: | @@ -149,23 +167,17 @@ jobs: macos: runs-on: macOS-latest timeout-minutes: 30 - if: github.event.pull_request.draft == false + if: inputs.enable_macos steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - name: setup-cocoapods uses: maxim-lobanov/setup-cocoapods@v1 with: podfile-path: ./packages/audioplayers/example/macos/Podfile.lock - - name: Example app - Build macOS - working-directory: ./packages/audioplayers/example - run: | - flutter config --enable-macos-desktop - flutter build macos --release + - name: Run Flutter integration tests working-directory: ./packages/audioplayers/example run: | @@ -175,17 +187,12 @@ jobs: windows: runs-on: windows-latest timeout-minutes: 30 - if: github.event.pull_request.draft == false + if: inputs.enable_windows steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - - name: Example app - Build Windows app - working-directory: ./packages/audioplayers/example - run: | - flutter build windows --release + - name: Start audio server run: net start audiosrv - name: Install virtual audio device @@ -205,12 +212,10 @@ jobs: linux: runs-on: ubuntu-latest timeout-minutes: 30 - if: github.event.pull_request.draft == false + if: inputs.enable_linux steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - with: - channel: stable - uses: bluefireteam/melos-action@main - name: Install Flutter requirements for Linux run: | @@ -221,11 +226,7 @@ jobs: run: | sudo apt install -y libunwind-dev sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good gstreamer1.0-plugins-bad - - name: Example app - Build Linux app - working-directory: ./packages/audioplayers/example - run: | - flutter config --enable-linux-desktop - flutter build linux --release + - name: Run Flutter integration tests working-directory: ./packages/audioplayers/example run: |