Skip to content

Commit

Permalink
build in container
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Sep 2, 2024
1 parent 2439dda commit 9123a85
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ jobs:
- pre-commit
with:
kind: "${{ inputs.kind }}"
cmd: "${{ inputs.package_command }}"
cmd: python -m build
#cmd: "${{ inputs.package_command }}"

test:
name: Test
Expand Down
63 changes: 43 additions & 20 deletions .github/workflows/package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,57 @@ jobs:
build:
name: Build Python Wheel
runs-on: ubuntu-latest
container:
image: debian:11
# volumes:
# - ${{ github.workspace }}:/src
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Install pypa/pkginffo
# - name: Set up Python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"

- name: Update Apt
run: >-
python -m
pip install
pkginfo
--user
apt-get update
- name: Install dependencies
- name: Install OS Dependencies
run: >-
sudo apt-get install -y gcc python3
apt-get install -y gcc python3
python3-pip python3-venv flex make
texinfo unzip help2man gawk libtool-bin libncurses5-dev
bison wget rsync
bison wget rsync git
# - name: Change dir to source directory
# run: |
# cd /src

- name: Create virtualenv
run: >-
python3 -m venv venv
- name: Activate virtualenv
run: |
. venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Python Version
run: >-
python3 --version
- name: Install Python Dependencies
run: >-
pip install build wheel setuptools pkginfo
- name: Echo Build Wheel Command
run: echo "${{ inputs.cmd }}"

- name: Build Wheel
run: "${{ inputs.cmd }}"
run: |
${{ inputs.cmd }}
- name: Python Build Artifact
uses: actions/upload-artifact@v3
Expand All @@ -67,11 +85,16 @@ jobs:
name: dist
path: dist/*
retention-days: 5

- name: List dist directory
run: |
ls -lah dist
- name: Read Version
run: >-
python3
-c
"from pkginfo import Wheel; s = Wheel('dist/$(ls dist/)'); print(f'version={s.version}')"
"from pkginfo import Wheel; s = Wheel('''dist/$(ls dist/*.whl)'''); print('version='+str(s.version))"
>>
$GITHUB_OUTPUT
id: version
2 changes: 1 addition & 1 deletion src/ppt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2024 Broadcom Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Protable toolchains for python
Portable Python Toolchains.
"""
from .common import environ

Expand Down
7 changes: 5 additions & 2 deletions src/ppt/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import csv
import logging
import pathlib

from .build import build_arch, extract_archive, get_triplet
Expand All @@ -19,15 +20,17 @@

distinfo = pathlib.Path(__file__).resolve().parent.parent / "ppt-0.1.0.dist-info"

log = logging.getLogger(__name__)


def environ():
"""
Toolchain build environment.
"""
if toolchain.exists():
print("Toolchain directory exists")
log.debug("Toolchain directory exists")
else:
print("extract archive")
log.info("Extract archive")
extract_archive(toolchain_root, str(archive))
record = distinfo / "RECORD"
if record.exists():
Expand Down

0 comments on commit 9123a85

Please sign in to comment.