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
21 changes: 21 additions & 0 deletions .github/actions/build-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build version
description: >-
Works out the build version and stamps it into pubspec.yaml, exporting
WIMSY_VERSION, WIMSY_VERSION_CORE, WIMSY_BUILD_NUMBER and WIMSY_MSIX_VERSION
to later steps in the job. Maps GitHub's tag ref and run number onto the
provider-neutral tool/fetch_release_history.sh and tool/build_version.sh.
The repository must already be checked out.
runs:
using: composite
steps:
- name: Fetch release history
shell: bash
run: bash tool/fetch_release_history.sh
- name: Set build version
shell: bash
# Passed via env, not interpolated into the script, so a tag name
# cannot inject shell.
env:
RELEASE_TAG: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }}
BUILD_NUMBER: ${{ github.run_number }}
run: bash tool/build_version.sh --tag "$RELEASE_TAG" --build-number "$BUILD_NUMBER" --write-pubspec | tee -a "$GITHUB_ENV"
159 changes: 32 additions & 127 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@ jobs:
channel: stable
cache: true
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Install xmpp_stone dependencies
Expand All @@ -43,6 +28,20 @@ jobs:
- name: Test
run: flutter test

test-ci-scripts:
# The version scripts run on all three runner types, so test them on all
# three, in parallel with the builds rather than in front of them.
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Test CI scripts
shell: bash
run: bash tool/test_build_version.sh

dependency-vulnerability-scan:
needs: analyze
runs-on: ubuntu-latest
Expand Down Expand Up @@ -230,22 +229,7 @@ jobs:
with:
targets: x86_64-unknown-linux-gnu
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Show compiler versions
Expand All @@ -263,7 +247,8 @@ jobs:
tar -C build/linux/x64/release -czf wimsy-linux.tar.gz bundle
- name: Package Linux (.deb)
run: |
VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}')
# Display version without the +build suffix now in pubspec.yaml.
VERSION="$WIMSY_VERSION"
PKG_DIR="wimsy_${VERSION}_amd64"
mkdir -p "$PKG_DIR/DEBIAN" \
"$PKG_DIR/usr/lib/wimsy" \
Expand Down Expand Up @@ -334,22 +319,7 @@ jobs:
with:
targets: x86_64-pc-windows-msvc
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Build Windows
Expand Down Expand Up @@ -384,41 +354,18 @@ jobs:
with:
targets: x86_64-apple-darwin,aarch64-apple-darwin
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Build macOS
run: flutter build macos --release
# Numeric-only build name: Flutter mangles the -pre-<sha> display
# version on Apple platforms. The build number comes from pubspec.yaml.
run: flutter build macos --release --build-name "$WIMSY_VERSION_CORE"
- name: Package macOS
run: tool/package_macos_dmg.sh build/macos/Build/Products/Release/wimsy.app wimsy-macos.dmg
- name: Verify macOS package
shell: bash
run: |
set -euo pipefail
# Only tag builds have a version Flutter passes through unchanged:
# pre-release versions like 0.0.6-pre-<sha> are mangled into
# CFBundleShortVersionString (non-digits stripped), so skip the
# version check for those.
expected_version=""
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
expected_version="${GITHUB_REF#refs/tags/v}"
fi
tool/verify_macos_dmg.sh wimsy-macos.dmg "$expected_version"
run: tool/verify_macos_dmg.sh wimsy-macos.dmg "$WIMSY_VERSION_CORE" "$WIMSY_BUILD_NUMBER"
- name: Upload macOS artifact
uses: actions/upload-artifact@v6
with:
Expand All @@ -439,26 +386,12 @@ jobs:
with:
targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Build iOS
run: flutter build ios --no-codesign
# Numeric-only build name; see build-macos.
run: flutter build ios --no-codesign --build-name "$WIMSY_VERSION_CORE"
- name: Upload iOS artifact
uses: actions/upload-artifact@v6
with:
Expand All @@ -481,22 +414,7 @@ jobs:
- name: Install cargo-ndk
run: cargo install cargo-ndk --locked
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Build Android (release)
Expand Down Expand Up @@ -667,22 +585,7 @@ jobs:
channel: stable
cache: true
- name: Set Build Version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
base_tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
base_version="${base_tag#v}"
if [[ -z "$base_version" ]]; then
base_version="0.0.0"
fi
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
version="${GITHUB_REF#refs/tags/v}"
else
version="${base_version}-pre-$(git rev-parse --short HEAD)"
fi
sed -i -E "s/^version: .*/version: ${version}/" pubspec.yaml
echo "Build version set to ${version}"
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Test WebTransport in Chrome
Expand Down Expand Up @@ -715,6 +618,8 @@ jobs:
with:
channel: stable
cache: true
- name: Set Build Version
uses: ./.github/actions/build-version
- name: Install dependencies
run: flutter pub get
- name: Build Web (GitHub Pages)
Expand All @@ -728,7 +633,7 @@ jobs:
uses: actions/deploy-pages@v4

publish-release:
needs: [build-linux, build-windows, build-macos, build-android, build-web, sbom]
needs: [build-linux, build-windows, build-macos, build-android, build-web, sbom, test-ci-scripts]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
Expand Down
Loading
Loading