Skip to content

feat(software-update): update settings and auto-update on the Update Software API CU-17tkuw614a6 #9480

feat(software-update): update settings and auto-update on the Update Software API CU-17tkuw614a6

feat(software-update): update settings and auto-update on the Update Software API CU-17tkuw614a6 #9480

Workflow file for this run

name: OpenFrame OSS Libs Test
permissions:
contents: read
pull-requests: read
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened, closed]
branches: [main]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
REGISTRY: "com.openframe.oss"
ORGANISATION: ${{ github.repository_owner }}
REPOSITORY: "com/openframe/oss/${{ github.event.repository.name }}"
# =============================================================================
# JOBS
# =============================================================================
jobs:
changes:
name: Changes
uses: ./.github/workflows/changes.yaml
if: github.event_name == 'merge_group' || (github.event.pull_request.state == 'open' && !github.event.pull_request.draft)
lint:
name: "Lint"
runs-on: ubuntu-latest
if: github.event.action != 'closed'
permissions:
pull-requests: write
steps:
- name: Assign PR author
if: github.event.action == 'opened' && github.event.pull_request.user.type == 'User'
env:
GH_TOKEN: ${{ github.token }}
run: gh pr edit ${{ github.event.pull_request.html_url }} --add-assignee ${{ github.event.pull_request.user.login }}
# Squash commits take the PR title; read live so a re-run picks up an edited title or the no-task label.
- name: Check PR title
if: github.event.pull_request.user.type == 'User' && !startsWith(github.head_ref, 'renovate/') # Renovate runs as a user
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.html_url }}
run: |
gh pr view "$PR" --json title,labels -q '.title + if any(.labels[]; .name == "no-task") then " CU-notask" else "" end' \
| grep -qE "^(feat|fix|perf|refactor|docs|test|build|ci|chore|style|revert)(\(.+\))?!?: .+ CU-[0-9a-z]+$" \
|| { echo "::error::Expected 'fix(armor): exclude billing action CU-17tkuw5x3yh' (no-task label drops CU-); fix the title and re-run"; exit 1; }
test-java:
name: Test Java
runs-on: ubuntu-latest
needs: [changes]
if: fromJSON(needs.changes.outputs.changes || '{}').java == 'true'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
# Merge queue only builds and tests; snapshots are published per PR.
- name: Resolve PR Snapshot Version
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
URL="https://maven.pkg.github.com/${{ github.repository }}/${{ env.REPOSITORY }}/maven-metadata.xml"
OLD_VERSION=$(curl -sf -H "Authorization: token $GITHUB_TOKEN" "$URL" |
grep -oP '<version>\K[0-9]+\.[0-9]+\.[0-9]+(?=</version>)' | sort -V | tail -1)
echo "NEW_VERSION=${OLD_VERSION%.*}.$((${OLD_VERSION##*.} + 1))-${{ github.event.pull_request.number }}-SNAPSHOT" >> $GITHUB_ENV
- name: Build and Publish ${{ env.NEW_VERSION }}
id: build
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
mvn clean ${{ github.event_name == 'merge_group' && 'verify' || 'deploy' }} \
${NEW_VERSION:+-Drevision="$NEW_VERSION"} \
-s .mvn/settings.xml \
--threads 2C \
--batch-mode \
--no-transfer-progress \
-Dmaven.source.skip=true
test-node:
name: Test Node (openframe-frontend-core)
runs-on: ubuntu-latest
needs: [changes]
if: fromJSON(needs.changes.outputs.changes || '{}')['openframe-frontend-core'] == 'true'
# npm's defaults allow 970s of silence per hung registry socket; these bound it to 115s
env:
NPM_CONFIG_FETCH_TIMEOUT: 30000
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: 15000
NPM_CONFIG_LOGLEVEL: http
defaults:
run:
shell: bash
working-directory: openframe-frontend-core
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
# No lockfile is committed (.gitignore), so the cache keys on package.json.
cache: npm
cache-dependency-path: openframe-frontend-core/package.json
# Bundled npm intermittently throws "Cannot read properties of null (reading 'edgesOut')" without a lockfile.
- name: Upgrade npm
run: npm install -g npm@11.9.0
# `install`, not `ci`: `ci` needs a lockfile.
- name: Install Dependencies
run: npm install
# ~1s; a broken eslint config makes every lint result below meaningless.
# Disabled: covered by "Flamingo Code Review / tests and checks" (npm run lint:config-smoke in openframe-frontend-core). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
- name: Lint Config Smoke
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
run: npm run lint:config-smoke
# Disabled: covered by "Flamingo Code Review / tests and checks" (npm run type-check in openframe-frontend-core). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
- name: Type Check
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
run: npm run type-check
# Disabled: covered by "Flamingo Code Review / tests and checks" (npm run lint in openframe-frontend-core). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
- name: Lint
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
run: npm run lint
# Needs a TypeScript program and an 8 GB heap; the slowest check, so kept apart.
# Disabled: covered by "Flamingo Code Review / tests and checks" (npm run lint:types in openframe-frontend-core). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
- name: Lint (type-aware)
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
run: npm run lint:types
# Disabled: covered by "Flamingo Code Review / tests and checks" (npm run format in openframe-frontend-core). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
- name: Format
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
run: npm run format
- name: Test
run: npm run test:run
- name: Build
run: npm run build
# No local (file:/link:/.yalc) specs may reach the registry - see the script.
- name: Check publish manifest
run: node scripts/check-publish-manifest.mjs package.json
# --ignore-scripts skips a prepack rebuild.
- name: Pack
if: github.event_name == 'pull_request'
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
OLD_VERSION=$(git ls-remote --tags --refs origin | cut -d/ -f3 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
npm version "${OLD_VERSION%.*}.$((${OLD_VERSION##*.} + 1))-${{ github.event.pull_request.number }}.${{ github.run_number }}.${{ github.run_attempt }}" --no-git-tag-version
echo "PACKAGE_TARBALL=$PWD/$(npm pack --ignore-scripts --json | jq -r '.[0].filename')" >> "$GITHUB_ENV"
echo "SHORT_SHA=${HEAD_SHA::7}" >> "$GITHUB_ENV"
# PR builds go to pkg.pr.new only.
- name: Preview registry (pkg.pr.new) @${{ env.SHORT_SHA }} (@${{ github.event.pull_request.number }} tag)
if: github.event_name == 'pull_request'
run: |
npm exec --no -- pkg-pr-new publish --no-compact --no-template --comment=off --json pkg-pr-new.json "$PACKAGE_TARBALL"
jq -r '.packages[0].url' pkg-pr-new.json >> "$GITHUB_STEP_SUMMARY"
# Own job for wall clock: graph-wide and slower than all of test-node; sequential made PR checks ~16 min.
# Keep it in all-checks; it once reported zero for months with a real cycle in the tree.
test-node-cycles:
name: Test Node Cycles (openframe-frontend-core)
runs-on: ubuntu-latest
needs: [changes]
# Disabled: covered by "Flamingo Code Review / tests and checks" (npm run lint:cycles in openframe-frontend-core). Kept here, not deleted: the repository variable FLAMINGO_LEGACY_CHECKS=on runs it again. CU-17tkuw60a9u
# was: if: fromJSON(needs.changes.outputs.changes || '{}')['openframe-frontend-core'] == 'true'
if: vars.FLAMINGO_LEGACY_CHECKS == 'on'
env:
NPM_CONFIG_FETCH_TIMEOUT: 30000
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: 15000
NPM_CONFIG_LOGLEVEL: http
defaults:
run:
working-directory: openframe-frontend-core
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: openframe-frontend-core/package.json
# Same bundled-npm bug as in test-node.
- name: Upgrade npm
run: npm install -g npm@11.9.0
- name: Install Dependencies
run: npm install
- name: Lint (import cycles)
run: npm run lint:cycles
test-rust:
name: "Test Rust (${{ matrix.os }})"
needs: changes
if: fromJSON(needs.changes.outputs.changes || '{}').rust == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
defaults:
run:
shell: bash
env:
OPENFRAME_VERSION: 0.0.0-dev
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- name: Prepare Rust tools
uses: ./.github/steps/rust-setup
with:
path: clients/openframe-client
components: clippy,rustfmt
shared-key: openframe-client-${{ matrix.os }}
- name: Lint (cargo fmt --check + cargo clippy -D warnings)
run: make -C clients/openframe-client lint
- name: Build client binary
run: make -C clients/openframe-client build-bin
- name: Test
run: make -C clients/openframe-client test
cleanup:
name: Cleanup
if: github.event_name == 'pull_request' && github.event.pull_request.state != 'open'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Delete PR ${{ github.event.pull_request.number }} java snapshots
env:
GH_TOKEN: ${{ github.token }}
SUFFIX: -${{ github.event.pull_request.number }}-SNAPSHOT
run: |
gh api "/orgs/${{ env.ORGANISATION }}/packages?package_type=maven" --paginate \
--jq '.[] | select(.name | startswith("${{ env.REGISTRY }}.")) | .name' |
while read -r PKG; do
gh api "/orgs/${{ env.ORGANISATION }}/packages/maven/$PKG/versions" --paginate \
--jq "[.[] | select(.name | endswith(\"$SUFFIX\"))] | .[].id" |
xargs -r -I{} gh api --silent -X DELETE "/orgs/${{ env.ORGANISATION }}/packages/maven/$PKG/versions/{}"
done
all-checks:
name: "All Checks"
needs: [changes, test-java, test-node, test-node-cycles, test-rust, lint]
runs-on: ubuntu-latest
if: |
always() &&
(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || !contains(needs.*.result, 'skipped'))
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
- run: echo "All checks passed"