File: package_linux.yml

package info (click to toggle)
apache-arrow 23.0.1-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 76,220 kB
  • sloc: cpp: 654,608; python: 70,522; ruby: 45,964; ansic: 18,742; sh: 7,365; makefile: 669; javascript: 125; xml: 41
file content (333 lines) | stat: -rw-r--r-- 11,804 bytes parent folder | download | duplicates (3)
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

name: Package Linux

on:
  push:
    branches:
      - '**'
      - '!dependabot/**'
      - '!release-*'
    paths:
      - '.github/workflows/check_labels.yml'
      - '.github/workflows/package_linux.yml'
      - '.github/workflows/report_ci.yml'
      - 'cpp/**'
      - 'c_glib/**'
      - 'dev/archery/archery/**'
      - 'dev/release/binary-task.rb'
      - 'dev/release/verify-apt.sh'
      - 'dev/release/verify-yum.sh'
      - 'dev/tasks/linux-packages/**'
      - 'format/Flight.proto'
    tags:
      - "apache-arrow-*-rc*"
  pull_request:
    paths:
      - '.github/workflows/check_labels.yml'
      - '.github/workflows/package_linux.yml'
      - '.github/workflows/report_ci.yml'
      - 'cpp/**'
      - 'c_glib/**'
      - 'dev/archery/archery/**'
      - 'dev/release/binary-task.rb'
      - 'dev/release/verify-apt.sh'
      - 'dev/release/verify-yum.sh'
      - 'dev/tasks/linux-packages/**'
      - 'format/Flight.proto'
    types:
      - labeled
      - opened
      - reopened
      - synchronize
  schedule:
    - cron: "0 2 * * *"

concurrency:
  group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
  cancel-in-progress: true

permissions:
  actions: read
  # Upload to GitHub Release
  contents: write
  pull-requests: read

jobs:
  check-labels:
    if: github.event_name != 'schedule' || github.repository == 'apache/arrow'
    uses: ./.github/workflows/check_labels.yml
    secrets: inherit
    with:
      parent-workflow: package_linux

  package:
    name: ${{ matrix.id }}
    runs-on: ${{ contains(matrix.id, 'amd64') && 'ubuntu-latest' || 'ubuntu-24.04-arm' }}
    needs: check-labels
    if: >-
      needs.check-labels.outputs.force == 'true' ||
      contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 'CI: Extra') ||
      contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 'CI: Extra: Package: Linux')
    timeout-minutes: 75
    strategy:
      fail-fast: false
      matrix:
        id:
          - almalinux-8-amd64
          - almalinux-8-arm64
          - almalinux-9-amd64
          - almalinux-9-arm64
          - almalinux-10-amd64
          - almalinux-10-arm64
          - amazon-linux-2023-amd64
          - amazon-linux-2023-arm64
          - centos-9-stream-amd64
          - centos-9-stream-arm64
          - debian-bookworm-amd64
          - debian-bookworm-arm64
          - debian-trixie-amd64
          - debian-trixie-arm64
          - debian-forky-amd64
          - debian-forky-arm64
          - ubuntu-jammy-amd64
          - ubuntu-jammy-arm64
          - ubuntu-noble-amd64
          - ubuntu-noble-arm64
    env:
      DOCKER_VOLUME_PREFIX: ".docker/"
    steps:
      - name: Checkout Arrow
        uses: actions/checkout@v6
        with:
          fetch-depth: 0
          submodules: recursive
      - name: Free up disk space
        run: |
          ci/scripts/util_free_space.sh
      - name: Prepare environment variables
        env:
          ID: ${{ matrix.id }}
        run: |
          set -x

          case "${ID}" in
            centos-*)
              # Example: centos-9-stream-amd64 -> centos
              distribution="${ID%%-*}"
              ;;
            *)
              # Example: almalinux-8-amd64 -> almalinux
              # Example: amazon-linux-2023-amd64 -> amazon-linux
              distribution="${ID%-*-*}"
              ;;
          esac
          echo "DISTRIBUTION=${distribution}" >> "${GITHUB_ENV}"

          # Example: almalinux-8-amd64 -> amd64
          architecture="${ID##*-}"
          echo "ARCHITECTURE=${architecture}" >> "${GITHUB_ENV}"

          # Example: almalinux-8-amd64 -> almalinux-8
          target="${ID%-*}"
          case "${target}" in
            almalinux-*|amazon-linux-*|centos-*)
              echo "TASK_NAMESPACE=yum" >> "${GITHUB_ENV}"
              # Example: centos-9-stream-amd64 -> centos-9-stream
              # Example: amazon-linux-2023-amd64 -> amazon-linux-2023
              version="${ID%-*}"
              # Example: centos-9-stream -> 9-stream
              # Example: amazon-linux-2023 -> 2023
              version="${version##${distribution}-}"
              echo "DISTRIBUTION_VERSION=${version}" >> "${GITHUB_ENV}"
              if [ "${architecture}" = "arm64" ]; then
                # Example: almalinux-8 -> almalinux-8-aarch64
                target="${target}-aarch64"
              fi
              echo "YUM_TARGETS=${target}" >> "${GITHUB_ENV}"
              ;;
            *)
              echo "TASK_NAMESPACE=apt" >> "${GITHUB_ENV}"
              # Example: debian-bookworm-amd64 -> debian-bookworm
              code_name="${ID%-*}"
              # Example: debian-bookworm -> bookworm
              code_name="${code_name#*-}"
              echo "DISTRIBUTION_CODE_NAME=${code_name}" >> "${GITHUB_ENV}"
              if [ "${architecture}" = "arm64" ]; then
                # Example: ubuntu-noble -> ubuntu-noble-arm64
                target="${target}-arm64"
              fi
              echo "APT_TARGETS=${target}" >> "${GITHUB_ENV}"
              ;;
          esac
          echo "TARGET=${target}" >> "${GITHUB_ENV}"

          if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
            # Example: apache-arrow-21.0.0-rc0 -> 21.0.0-rc0
            version="${GITHUB_REF_NAME#apache-arrow-}"
            echo "ARROW_VERSION=${version}" >> "${GITHUB_ENV}"
          fi
      - name: Cache Docker Volumes
        uses: actions/cache@v5
        with:
          path: .docker
          key:  package-linux-${{ matrix.id }}-${{ hashFiles('cpp/**', 'c_glib/**') }}
          restore-keys: package-linux-${{ matrix.id }}-
      - name: Set up Ruby
        run: |
          sudo apt update
          sudo apt install -y \
            rake \
            ruby \
            ruby-dev
      - name: Prepare apache-arrow-apt-source for arm64
        if: env.ARCHITECTURE == 'arm64'
        run: |
          pushd dev/tasks/linux-packages/apache-arrow-apt-source/apt
          for target in *-*; do
            cp -a ${target} ${target}-arm64
          done
          popd
      - name: Prepare apache-arrow-release for arm64
        if: env.ARCHITECTURE == 'arm64'
        run: |
          pushd dev/tasks/linux-packages/apache-arrow-release/yum
          for target in *-*; do
            cp -a ${target} ${target}-aarch64
          done
          popd
      - name: Update version
        if: github.ref_type != 'tag'
        run: |
          pushd dev/tasks/linux-packages
          rake version:update
          popd
      - name: Login to GitHub Container registry
        uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Wait for creating GitHub Release
        if: github.ref_type == 'tag'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          dev/release/utils-watch-gh-workflow.sh \
            ${GITHUB_REF_NAME} \
            release_candidate.yml
      - name: Build
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          pushd dev/tasks/linux-packages
          rake docker:pull || :
          rake --trace ${TASK_NAMESPACE}:build BUILD_DIR=build
          popd
      - name: Docker Push
        continue-on-error: true
        if: >-
          success() &&
          github.event_name == 'push' &&
          github.ref_name == 'main'
        run: |
          pushd dev/tasks/linux-packages
          rake docker:push
          popd
      - name: Build artifact tarball
        run: |
          mkdir -p "${DISTRIBUTION}"
          cp -a \
            dev/tasks/linux-packages/*/${TASK_NAMESPACE}/repositories/${DISTRIBUTION}/* \
            "${DISTRIBUTION}/"
          set -x
          # We use latest .deb/.rpm of
          # apache-arrow-apt-source/apache-arrow-release built for
          # amd64 because they are architecture independent.
          if [ "${ARCHITECTURE}" = "amd64" ]; then
            if [ "${TASK_NAMESPACE}" = "apt" ]; then
              # Create
              # https://packages.apache.org/artifactory/arrow/${DISTRIBUTION}/apache-arrow-apt-source-latest-${DISTRIBUTION_CODE_NAME}.deb
              # for easy to install.
              cp -a \
                ${DISTRIBUTION}/pool/${DISTRIBUTION_CODE_NAME}/*/a/apache-arrow-apt-source/*.deb \
                ${DISTRIBUTION}/apache-arrow-apt-source-latest-${DISTRIBUTION_CODE_NAME}.deb
            else
              # Create
              # https://packages.apache.org/artifactory/arrow/${DISTRIBUTION}/${DISTRIBUTION_VERSION}/apache-arrow-release-latest.rpm
              # for easy to install.
              cp -a \
                ${DISTRIBUTION}/${DISTRIBUTION_VERSION}/x86_64/Packages/apache-arrow-release-*.rpm \
                ${DISTRIBUTION}/${DISTRIBUTION_VERSION}/apache-arrow-release-latest.rpm
            fi
          fi
          tar cvzf ${{ matrix.id }}.tar.gz ${DISTRIBUTION}
          dev/release/utils-generate-checksum.sh ${{ matrix.id }}.tar.gz
      - name: Upload the artifacts to the job
        uses: actions/upload-artifact@v6
        with:
          name: ${{ matrix.id }}
          path: ${{ matrix.id }}.tar.gz*
      - name: Upload the artifacts to GitHub Release
        if: github.ref_type == 'tag'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release upload ${GITHUB_REF_NAME} \
            --clobber \
            ${{ matrix.id }}.tar.gz*
      - name: Set up test
        run: |
          sudo apt install -y \
            apt-utils \
            cpio \
            createrepo-c \
            devscripts \
            gpg \
            rpm \
            rsync
          gem install --user-install apt-dists-merge
          {
            echo "Key-Type: RSA"
            echo "Key-Length: 4096"
            echo "Name-Real: Test"
            echo "Name-Email: test@example.com"
            echo "%no-protection"
          } | gpg --full-generate-key --batch
          GPG_KEY_ID=$(gpg --list-keys --with-colon test@example.com | grep fpr | cut -d: -f10)
          echo "GPG_KEY_ID=${GPG_KEY_ID}" >> ${GITHUB_ENV}
          if [ "${TASK_NAMESPACE}" = "yum" ]; then
            repositories_dir=dev/tasks/linux-packages/apache-arrow-release/yum/repositories
            rpm2cpio ${repositories_dir}/*/*/*/Packages/apache-arrow-release-*.noarch.rpm |
              cpio -id
            mv etc/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow \
              dev/tasks/linux-packages/KEYS
          fi
          gpg --export --armor test@example.com >> dev/tasks/linux-packages/KEYS
      - name: Test
        run: |
          pushd dev/tasks/linux-packages
          rake --trace ${TASK_NAMESPACE}:test
          popd

  report-package-linux:
    if: github.event_name == 'schedule' && always()
    needs:
      - package
    uses: ./.github/workflows/report_ci.yml
    secrets: inherit