File: release_linux.yml

package info (click to toggle)
onnx 1.20.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 62,544 kB
  • sloc: python: 77,643; cpp: 60,445; sh: 52; makefile: 51; javascript: 1
file content (174 lines) | stat: -rw-r--r-- 7,147 bytes parent folder | download | duplicates (2)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0

name: LinuxRelease

on:
  workflow_call:
    inputs:
      os:
        required: true
        type: string
      build_mode:
        required: true
        type: string

permissions:
  contents: read

jobs:
  build:
    if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs')

    strategy:
      matrix:
        python-version: ['3.13t', '3.12', '3.11', '3.10']
        architecture: ['x64', 'arm64']
      fail-fast: false

    env:
      MANYLINUX_WHEEL_X64: "manylinux_2_28_x86_64"
      MANYLINUX_WHEEL_ARM64: "manylinux_2_28_aarch64"

    runs-on: ${{ matrix.architecture == 'x64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}

    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      with:
        persist-credentials: true
        submodules: true

    - name: Configure Git safe directory
      run: |
        git config --global --add safe.directory /github/workspace

    - name: Set source date epoch variable
      run: |
        echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV

    - name: Build wheel for x86_64
      if: matrix.architecture == 'x64'
      id: build_wheel_x86
      uses: docker://quay.io/pypa/manylinux_2_28_x86_64:2025.10.10-1
      with:
        entrypoint: bash
        args: .github/workflows/manylinux/entrypoint.sh ${{ matrix.python-version }} manylinux_2_28_x86_64 ${{ inputs.build_mode }} ${{ env.SOURCE_DATE_EPOCH }}

    - name: Build wheel for arm64
      if: matrix.architecture == 'arm64'
      id: build_wheel_arm64
      uses: docker://quay.io/pypa/manylinux_2_28_aarch64:2025.10.10-1
      with:
        entrypoint: bash
        args: .github/workflows/manylinux/entrypoint.sh ${{ matrix.python-version }} manylinux_2_28_aarch64 ${{ inputs.build_mode }} ${{ env.SOURCE_DATE_EPOCH }}

    - name: Debug Python version and artifact name
      run: |
        echo "PYTHON VERSION: ${{ matrix.python-version }}"
        if [ "${{ matrix.python-version }}" = "3.12" ]; then
          echo "Artifact name: wheels-${{ inputs.os }}-${{ matrix.architecture }}-3.12-abi3"
        else
          echo "Artifact name: wheels-${{ inputs.os }}-${{ matrix.architecture }}-${{ matrix.python-version }}"
        fi

    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
      if: (steps.build_wheel_arm64.outcome == 'success' || steps.build_wheel_x86.outcome == 'success') && (inputs.build_mode == 'preview' || !contains(matrix.python-version, 'dev')) && (matrix.python-version == '3.12')
      with:
        name: wheels-${{ inputs.os }}-${{ matrix.architecture }}-3.12-abi3
        path: |
            ./dist/*.whl
    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
      if: (steps.build_wheel_arm64.outcome == 'success' || steps.build_wheel_x86.outcome == 'success') && (inputs.build_mode == 'preview' || !contains(matrix.python-version, 'dev')) && (matrix.python-version != '3.12')
      with:
        name: wheels-${{ inputs.os }}-${{ matrix.architecture }}-${{ matrix.python-version }}
        path: |
            ./dist/*.whl



  test:
    needs: build
    runs-on: ${{ matrix.architecture == 'x64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
    env:
      MANYLINUX_WHEEL_X64: "manylinux_2_28_x86_64"
      MANYLINUX_WHEEL_ARM64: "manylinux_2_28_aarch64"
    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12', '3.13', '3.13t', '3.14-dev']
        architecture: ['x64', 'arm64']
      fail-fast: false
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          persist-credentials: true
          submodules: true
      - uses: actions/download-artifact@v5
        if: matrix.python-version == '3.12' || matrix.python-version == '3.13' || matrix.python-version == '3.14-dev'
        with:
          name: wheels-${{ inputs.os }}-${{ matrix.architecture }}-3.12-abi3
          path: ./dist
      - uses: actions/download-artifact@v5
        if: matrix.python-version != '3.12' && matrix.python-version != '3.13' && matrix.python-version != '3.14-dev'
        with:
          name: wheels-${{ inputs.os }}-${{ matrix.architecture }}-${{ matrix.python-version }}
          path: ./dist
      - uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
          architecture: ${{ matrix.architecture }}

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
        with:
          python-version: ${{ matrix.python-version }}
          architecture: ${{ matrix.architecture }}

      - name: Install Python dependencies
        run: |
          python -m pip install -q --upgrade pip
          python -m pip install -q -r requirements-release_test.txt

      - name: Check abi3 compatibility with abi3audit
        run: |
          if [ $(ls dist/*.whl | wc -l) -eq 1 ]; then
              echo "Exactly one wheel file found."
          else
              echo "Multiple or no wheel files found."
          fi
          for whl in dist/*${{ matrix.architecture == 'x64' && env.MANYLINUX_WHEEL_X64 || env.MANYLINUX_WHEEL_ARM64 }}*.whl; do
            echo "Checking abi3 compatibility for $whl"
            python -m abi3audit -v "$whl"
          done

      - name: Install protobuf in the GitHub Action environment for testing the wheel
        run: |
          source workflow_scripts/protobuf/build_protobuf_unix.sh $(nproc)

      - name: Test wheel with Python ${{ matrix.python-version }}
        if: matrix.python-version != '3.14-dev'
        run: |
          # example file name: ./dist/onnx_weekly-1.19.0.dev20250528-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
          python -m pip install dist/*${{ matrix.architecture == 'x64' && env.MANYLINUX_WHEEL_X64 || env.MANYLINUX_WHEEL_ARM64 }}*.whl
          pytest

      - name: Verify ONNX with the latest numpy
        if: matrix.python-version != '3.14-dev'
        run: |
          python -m pip uninstall -y numpy onnx && python -m pip install numpy
          python -m pip install dist/*${{ matrix.architecture == 'x64' && env.MANYLINUX_WHEEL_X64 || env.MANYLINUX_WHEEL_ARM64 }}*whl
          pytest

      - name: Verify ONNX with the latest protobuf
        if: matrix.python-version != '3.14-dev'
        run: |
          python -m pip uninstall -y protobuf onnx && python -m pip install protobuf
          python -m pip install dist/*${{ matrix.architecture == 'x64' && env.MANYLINUX_WHEEL_X64 || env.MANYLINUX_WHEEL_ARM64 }}*whl
          pytest

      - name: Verify ONNX with the minimumly supported packages
        if: matrix.python-version != '3.14-dev'
        run: |
          python -m pip uninstall -y numpy protobuf onnx && python -m pip install -r requirements-min.txt
          python -m pip install dist/*${{ matrix.architecture == 'x64' && env.MANYLINUX_WHEEL_X64 || env.MANYLINUX_WHEEL_ARM64 }}*whl
          pytest