Skip to content

fix(python): keep original F# field names in record reflection (#4852) #4153

fix(python): keep original F# field names in record reflection (#4852)

fix(python): keep original F# field names in record reflection (#4852) #4153

Workflow file for this run

name: build
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
id-token: write
security-events: write
jobs:
# Separate job that verifies if all code was formatted correctly
# Run `dotnet fantomas .` to format all code.
verify-linting:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Restore tools
run: dotnet tool restore
- name: Check F# code
run: dotnet fantomas . --check --verbosity d
# Verify that Fable.sln can be restored
# See: https://github.com/fable-compiler/Fable/issues/3687
restore-project:
name: Check that solution can be restored
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Restore project
run: dotnet restore Fable.sln
# Separate build job for JavaScript
build-javascript:
# Expecto has been hanging randomly (started a few days ago, cause unknown) - keep this
# tight so a hang fails fast instead of burning the full hour. See:
# https://github.com/fable-compiler/Fable/actions/runs/28803363016/job/85412364876
timeout-minutes: 10
strategy:
matrix:
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Node.js environment
uses: actions/setup-node@v7
- name: Fable Tests - JavaScript (linux)
if: matrix.platform == 'ubuntu-latest'
run: ./build.sh test javascript
- name: Fable Tests - JavaScript (Windows)
if: matrix.platform == 'windows-latest'
run: .\build.bat test javascript
# Separate build job for TypeScript
build-typescript:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Node.js environment
uses: actions/setup-node@v7
- name: Fable Tests - TypeScript
run: ./build.sh test typescript
# - name: Fable Tests - TypeScript
# run: dotnet fsi build.fsx test-ts
# Separate build job for Integration
build-integration:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Node.js environment
uses: actions/setup-node@v7
- name: Fable Tests
run: ./build.sh test integration
# Separate build job for Standalone
build-standalone:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Node.js environment
uses: actions/setup-node@v7
- name: Fable Tests
run: ./build.sh test standalone
# Separate build job for Python since we use a test matrix (will run in parallell)
build-python:
timeout-minutes: 75
strategy:
matrix:
platform: [ubuntu-latest, windows-latest]
python-version: [3.12, 3.13, 3.14]
runs-on: ${{ matrix.platform }}
env:
UV_LINK_MODE: copy
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install maturin
run: uv tool install maturin
- name: Fable Library - Python (linux)
if: matrix.platform == 'ubuntu-latest'
run: ./build.sh fable-library --python
- name: Fable Library - Python (Windows)
if: matrix.platform == 'windows-latest'
run: .\build.bat fable-library --python
- name: Fable Tests - Python (linux)
if: matrix.platform == 'ubuntu-latest'
run: ./build.sh test python
- name: Fable Tests - Python (Windows)
if: matrix.platform == 'windows-latest'
run: .\build.bat test python
# Native/Rust-extension unit tests for the published fable-library package.
# These live in src/fable-library-py/tests and exercise hand-written sources
# (fable_library.core, .union, .util) only, so no F# transpilation is needed.
# Previously this ran in publish-pypi.yml, where a failure was only visible
# at release time and did not actually gate the publish.
test-fable-library-py:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12", "3.13", "3.14"]
runs-on: ${{ matrix.platform }}
env:
UV_LINK_MODE: copy
steps:
- uses: actions/checkout@v7.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Build extension and run tests
working-directory: ./src/fable-library-py
run: |
uv sync --frozen
uv run --frozen maturin develop --release
uv run --frozen pytest tests
# Formatting gate for the fable-library-py Rust extension. Deliberately a
# separate job rather than a step in test-fable-library-py, so it runs once
# instead of once per cell of that job's 3x3 platform/Python matrix.
lint-fable-library-py:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
working-directory: ./src/fable-library-py
run: cargo fmt --check
# Separate build job for Rust (will run in parallel)
build-rust:
timeout-minutes: 75
runs-on: ubuntu-latest
strategy:
matrix:
test: ["default", "no_std", "threaded"]
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Node.js environment
uses: actions/setup-node@v7
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Fable Library - Rust
run: ./build.sh fable-library --rust
- name: Fable Tests - Rust
run: ./build.sh test rust --${{ matrix.test }}
# Separate build job for Dart
build-dart:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
- name: Fable Tests - Dart
run: ./build.sh test dart
# Separate build job for Beam (Erlang)
build-beam:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Setup Erlang/OTP
uses: erlef/setup-beam@v1
with:
otp-version: "27"
rebar3-version: "3"
- name: Fable Tests - Beam
run: ./build.sh test beam
# Separate job to run F# analyzers
analyzers:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
matrix:
project:
[
"src/Fable.AST/Fable.AST.fsproj",
"src/Fable.Transforms/Rust/AST/Rust.AST.fsproj",
"src/Fable.Transforms/Fable.Transforms.fsproj",
"src/Fable.Compiler/Fable.Compiler.fsproj",
]
steps:
- uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Restore tools
run: dotnet tool restore
- name: Build solution
run: dotnet build -c Release Fable.sln
- name: Run analyzers for ${{ matrix.project }}
run: dotnet msbuild /t:AnalyzeFSharpProject ${{ matrix.project }}
continue-on-error: true
- name: Upload SARIF files
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: src/reports
category: ${{ matrix.project }}