152 lines
4.7 KiB
YAML
152 lines
4.7 KiB
YAML
# Copyright 2025 Enactic, Inc.
|
|
#
|
|
# Licensed 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
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
- '!dependabot/**'
|
|
tags:
|
|
- '**'
|
|
pull_request:
|
|
concurrency:
|
|
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
source:
|
|
name: Source
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Create source archive
|
|
run: |
|
|
rake dist
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: source
|
|
path: |
|
|
openarm-can-*.tar.gz
|
|
build:
|
|
name: Build
|
|
needs: source
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
id:
|
|
- ubuntu-jammy-amd64
|
|
- ubuntu-jammy-arm64
|
|
- ubuntu-noble-amd64
|
|
- ubuntu-noble-arm64
|
|
env:
|
|
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow
|
|
# condition && true-case || false-case
|
|
# ==
|
|
# condition ? true-case : false-case
|
|
runs-on: >-
|
|
${{ (contains(matrix.id, 'arm64') ||
|
|
contains(matrix.id, 'aarch64')) && 'ubuntu-24.04-arm' ||
|
|
'ubuntu-latest' }}
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
path: apache-arrow
|
|
repository: apache/arrow
|
|
- name: Prepare environment variables
|
|
run: |
|
|
id=${{ matrix.id }}
|
|
# ubuntu-noble-amd64 -> ubuntu-noble
|
|
os_version=${id%-*}
|
|
# ubuntu-noble -> ubuntu
|
|
os=${os_version%-*}
|
|
# ubuntu-noble -> noble
|
|
version=${os_version##*-}
|
|
# ubuntu-noble-amd64 -> amd64
|
|
architecture=${id##*-}
|
|
|
|
if [ "${os}" = "debian" ] || [ "${os}" = "ubuntu" ]; then
|
|
TASK_NAMESPACE=apt
|
|
if [ "${architecture}" = "amd64" ]; then
|
|
echo "APT_TARGETS=${os_version}" >> "${GITHUB_ENV}"
|
|
TEST_DOCKER_IMAGE="${os}:${version}"
|
|
else
|
|
echo "APT_TARGETS=${id}" >> "${GITHUB_ENV}"
|
|
TEST_DOCKER_IMAGE="arm64v8/${os}:${version}"
|
|
fi
|
|
else
|
|
TASK_NAMESPACE=yum
|
|
# amazon-linux -> amazonlinux
|
|
docker_os=${os/-/}
|
|
if [ "${architecture}" = "x86_64" ]; then
|
|
echo "YUM_TARGETS=${os_version}" >> "${GITHUB_ENV}"
|
|
TEST_DOCKER_IMAGE="${docker_os}:${version}"
|
|
else
|
|
echo "YUM_TARGETS=${id}" >> "${GITHUB_ENV}"
|
|
TEST_DOCKER_IMAGE="arm64v8/${docker_os}:${version}"
|
|
fi
|
|
fi
|
|
echo "ARCHITECTURE=${architecture}" >> ${GITHUB_ENV}
|
|
echo "TASK_NAMESPACE=${TASK_NAMESPACE}" >> ${GITHUB_ENV}
|
|
echo "TEST_DOCKER_IMAGE=${TEST_DOCKER_IMAGE}" >> ${GITHUB_ENV}
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt update -o="APT::Acquire::Retries=3"
|
|
sudo apt install -y -V -o="APT::Acquire::Retries=3" \
|
|
devscripts \
|
|
ruby
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
name: source
|
|
- name: Update version
|
|
if: github.ref_type != 'tag'
|
|
run: |
|
|
cd packages
|
|
rake version:update
|
|
- name: Login to GitHub Container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build with docker
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
cd packages
|
|
rake docker:pull || :
|
|
rake ${TASK_NAMESPACE}:build BUILD_DIR=build
|
|
if [ "${TASK_NAMESPACE}" = "yum" ] && [ "${ARCHITECTURE}" != "x86_64" ]; then
|
|
# Remove SRPMs from non x86_64 artifacts
|
|
rm -rf ${TASK_NAMESPACE}/repositories/*/*/source
|
|
fi
|
|
- name: Push the built Docker image
|
|
continue-on-error: true
|
|
run: |
|
|
cd packages
|
|
rake docker:push
|
|
|
|
# Test
|
|
- name: Test
|
|
run: |
|
|
docker run \
|
|
--rm \
|
|
--volume ${PWD}:/host:ro \
|
|
${TEST_DOCKER_IMAGE} \
|
|
/host/packages/${TASK_NAMESPACE}/test.sh
|