Skip to content
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
35 changes: 34 additions & 1 deletion .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,39 @@ on:
pull_request:
branches: [ "main" ]

permissions:
contents: read

env:
FLUTTER_VERSION: '3.44.4'

jobs:
reproducibilityCheck:
name: Reproducibility check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
submodules: recursive
persist-credentials: false

Comment thread
coderabbitai[bot] marked this conversation as resolved.
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ env.FLUTTER_VERSION }}

- name: Check locked dependencies
env:
PUB_HOSTED_URL: https://pub.dev
run: |
flutter pub get --enforce-lockfile
git diff --exit-code -- pubspec.yaml pubspec.lock

- name: Check JNI build-id patch
run: scripts/release/patch-jni-build-id.sh

Comment thread
coderabbitai[bot] marked this conversation as resolved.
check:
runs-on: ubuntu-latest

Expand All @@ -20,11 +52,12 @@ jobs:
with:
fetch-depth: 1
submodules: recursive
persist-credentials: false

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
# flutter-version: '3.44.1'
flutter-version: ${{ env.FLUTTER_VERSION }}

- name: Install dependencies
run: flutter pub get
Expand Down
65 changes: 61 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
release:
description: 'Create GitHub Release (auto tag v1.0.<commit_count>)'
description: 'Create GitHub Release from the selected v1.0.<build> tag'
required: false
type: boolean
default: false
Expand All @@ -18,10 +18,65 @@ permissions:
env:
APP_NAME: ServerBox
BUILD_TAG: test-build-${{ github.run_number }}-${{ github.sha }}
FLUTTER_VERSION: "3.44.4"

jobs:
reproducibilityCheck:
name: Reproducibility check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
fetch-depth: 0
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Require tagged releases
if: inputs.release == true && github.ref_type != 'tag'
shell: bash
run: |
echo "Release builds must be started from a committed tag so the source can be reproduced by downstream builders."
echo "Create and push a v1.0.<build> tag after committing the release version files."
exit 1
- name: Check tag source version
if: github.ref_type == 'tag'
shell: bash
run: |
set -euo pipefail

expected="${GITHUB_REF_NAME#v}"
build="${expected##*.}"
pub_version="$(sed -n -E 's/^version:[[:space:]]*([^+]+)\+([0-9]+)$/\1+\2/p' pubspec.yaml | head -n 1)"
build_data="$(sed -n -E 's/.*static const int build = ([0-9]+);/\1/p' lib/data/res/build_data.dart | head -n 1)"

if [[ "$pub_version" != "$expected+$build" ]]; then
echo "pubspec.yaml version must match tag ${GITHUB_REF_NAME}; got ${pub_version}."
exit 1
fi

if [[ "$build_data" != "$build" ]]; then
echo "BuildData.build must match tag ${GITHUB_REF_NAME}; got ${build_data}."
exit 1
fi
- name: Check locked dependencies
shell: bash
env:
PUB_HOSTED_URL: https://pub.dev
run: |
flutter pub get --enforce-lockfile
git diff --exit-code -- pubspec.yaml pubspec.lock
- name: Check JNI build-id patch
shell: bash
run: scripts/release/patch-jni-build-id.sh

buildAndroid:
name: Build android
needs: reproducibilityCheck
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -34,7 +89,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.44.1"
flutter-version: ${{ env.FLUTTER_VERSION }}
- uses: actions/setup-java@v4
with:
distribution: "zulu"
Expand Down Expand Up @@ -86,6 +141,7 @@ jobs:

buildLinux:
name: Build linux
needs: reproducibilityCheck
strategy:
fail-fast: false
matrix:
Expand All @@ -108,7 +164,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: "3.44.1"
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install dependencies
run: |
sudo apt update
Expand Down Expand Up @@ -153,6 +209,7 @@ jobs:

buildWindows:
name: Build windows
needs: reproducibilityCheck
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -165,7 +222,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: "3.44.1"
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Build (release)
if: inputs.release == true || github.ref_type == 'tag'
shell: bash
Expand Down