Skip to content

Microphone gain fix #169

Microphone gain fix

Microphone gain fix #169

name: Build PR Artifacts
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
permissions:
actions: read
contents: read
pull-requests: write
concurrency:
group: pr-build-artifacts-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
APP_DIR: open_wearable
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: android
name: Android
os: ubuntu-latest
build_command: flutter build apk --release
artifact_name: android-apk
artifact_path: open_wearable/build/app/outputs/flutter-apk/app-release.apk
android: true
- target: linux
name: Linux
os: ubuntu-latest
build_command: flutter build linux --release
artifact_name: linux-bundle
artifact_path: open_wearable/build/linux/x64/release/bundle
linux_dependencies: true
- target: windows
name: Windows
os: windows-2022
build_command: flutter build windows --release
artifact_name: windows-runner
artifact_path: open_wearable/build/windows/x64/runner/Release
- target: web
name: Web
os: ubuntu-latest
build_command: flutter build web --release
artifact_name: web-bundle
artifact_path: open_wearable/build/web
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Linux build dependencies
if: ${{ matrix.linux_dependencies == true }}
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base \
libgtk-3-dev \
ninja-build \
pkg-config
- name: Set up Android build
if: ${{ matrix.android == true }}
uses: ./.github/actions/android-build-prepare
with:
app-dir: ${{ env.APP_DIR }}
- name: Set up Flutter project
if: ${{ matrix.android != true }}
uses: ./.github/actions/flutter-prepare
with:
app-dir: ${{ env.APP_DIR }}
- name: Build ${{ matrix.name }} artifact
working-directory: ${{ env.APP_DIR }}
run: ${{ matrix.build_command }}
- name: Upload ${{ matrix.name }} artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_path }}
if-no-files-found: error
comment_artifact_links:
name: Comment Artifact Links
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: Post or update PR comment with artifact links
uses: actions/github-script@v8
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
script: |
const marker = '<!-- pr-build-artifacts -->';
const prNumber = context.payload.pull_request.number;
const runUrl = process.env.RUN_URL;
const repoUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}`;
const artifactLabels = new Map([
['android-apk', 'Android APK'],
['linux-bundle', 'Linux Bundle'],
['windows-runner', 'Windows Runner'],
['web-bundle', 'Web Bundle'],
]);
const { data: artifactData } = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});
const artifactByName = new Map(
artifactData.artifacts.map((artifact) => [artifact.name, artifact])
);
const artifactLines = [...artifactLabels].map(([name, label]) => {
const artifact = artifactByName.get(name);
const url = artifact
? `${repoUrl}/actions/runs/${context.runId}/artifacts/${artifact.id}`
: runUrl;
return `- ${label}: [Download ${label}](${url})`;
});
const body = `${marker}
### PR Build Artifacts
${artifactLines.join('\n')}
Full workflow run: ${runUrl}`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const previous = comments.find(
(comment) =>
comment.user.type === 'Bot' &&
comment.body &&
comment.body.includes(marker)
);
if (previous) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: previous.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body,
});
}