Repository navigation
67 lines (61 loc) · 2.79 KB
/
Copy pathucode-syntax.yml
File metadata and controls
67 lines (61 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Compile every .uc file with the OLDEST ucode pbr must support. MANUAL ONLY.
#
# A build that works on master says nothing about the routers people run, so
# this gate is deliberately pointed at the old interpreter. The opposite
# direction (code that only OLD ucode accepts, such as adjacent template
# literals since ucode fe9e2947) is caught by the lint step in
# openwrt-release.yml, which compiles against ucode master on every push.
#
# UCODE_REF is the ucode shipped by OpenWrt 25.12 (package version
# 2026.01.16~85922056). Bump it only when the oldest SUPPORTED OpenWrt release
# moves — not when master moves.
#
# It MUST be the full 40-character SHA. `git fetch --depth 1 origin <sha>`
# resolves an object id, not a ref, and an abbreviated hash fails with
# "couldn't find remote ref". The OpenWrt package version only shows the short
# form, so expand it before pasting it here.
name: ucode syntax (oldest supported)
# Manual only. CI minutes are scarce here, and the check earns its keep on
# contributions from machines with a modern ucode -- where `{ foo() {...} }` and
# `export function f() {}` work perfectly and break every 25.12 router. Run it
# from the Actions tab when a PR touches .uc files, or locally with
# `tests/check-ucode-syntax.sh <path-to-old-ucode>`.
on:
workflow_dispatch:
jobs:
syntax:
runs-on: ubuntu-latest
env:
UCODE_REF: 85922056ef7abeace3cca3ab28bc1ac2d88e31b1
UCODE_REPO: https://github.com/jow-/ucode.git
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential cmake libjson-c-dev libmd-dev
- name: Cache the ucode build
id: ucode-cache
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/ucode-build
key: ucode-${{ env.UCODE_REF }}-${{ runner.os }}
- name: Build ucode at the oldest supported revision
if: steps.ucode-cache.outputs.cache-hit != 'true'
run: |
# Build outside the checkout: anything left in the workspace would be
# swept up by the file scan below.
cd "$RUNNER_TEMP"
git init -q ucode-src && cd ucode-src
git remote add origin "$UCODE_REPO"
git fetch -q --depth 1 origin "$UCODE_REF"
git checkout -q FETCH_HEAD
cd ..
# Modules are irrelevant to a syntax check and need OpenWrt libraries.
cmake -S ucode-src -B ucode-build -DCMAKE_BUILD_TYPE=Release \
-DRTNL_SUPPORT=OFF -DNL80211_SUPPORT=OFF \
-DUBUS_SUPPORT=OFF -DUCI_SUPPORT=OFF
cmake --build ucode-build -j"$(nproc)"
- name: Compile every .uc file
run: tests/check-ucode-syntax.sh "$RUNNER_TEMP/ucode-build/ucode"