Skip to content

.github/workflows: Reformat, fix problems and add heavy caching #4

.github/workflows: Reformat, fix problems and add heavy caching

.github/workflows: Reformat, fix problems and add heavy caching #4

Workflow file for this run

name: Generate Python
on:
workflow_call:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/generate-ruby.yml
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: [
2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 2.7.6, 2.7.7, 2.7.8, 2.7.9, 2.7.10, 2.7.11, 2.7.12, 2.7.13, 2.7.14, 2.7.15, 2.7.16, 2.7.17, 2.7.18,
3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5,
3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6,
3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5, 3.3.6, 3.3.7,
3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 3.4.8, 3.4.9, 3.4.10,
3.5.0, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.5.5, 3.5.6, 3.5.7, 3.5.8, 3.5.9, 3.5.10,
3.6.0, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7, 3.6.8, 3.6.9, 3.6.10, 3.6.11, 3.6.12, 3.6.13, 3.6.14, 3.6.15,
3.7.0, 3.7.1, 3.7.2, 3.7.3, 3.7.4, 3.7.5, 3.7.6, 3.7.7, 3.7.8, 3.7.9, 3.7.10, 3.7.11, 3.7.12, 3.7.13, 3.7.14, 3.7.15, 3.7.16, 3.7.17,
3.8.0, 3.8.1, 3.8.2, 3.8.3, 3.8.4, 3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.8.10, 3.8.11, 3.8.12, 3.8.13, 3.8.14, 3.8.15, 3.8.16, 3.8.17, 3.8.18,
3.9.0, 3.9.1, 3.9.2, 3.9.3, 3.9.4, 3.9.5, 3.9.6, 3.9.7, 3.9.8, 3.9.9, 3.9.10, 3.9.11, 3.9.12, 3.9.13, 3.9.14, 3.9.15, 3.9.16, 3.9.17, 3.9.18,
3.10.0, 3.10.1, 3.10.2, 3.10.3, 3.10.4, 3.10.5, 3.10.6, 3.10.7, 3.10.8, 3.10.9, 3.10.10, 3.10.11, 3.10.12, 3.10.13,
3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.11.4, 3.11.5, 3.11.6, 3.11.7, 3.11.8
]
steps:
- name: Check out the code
uses: actions/[email protected]
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Setup devbox
run: devbox run -- echo "done!"
- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
direnvVersion: 2.32.3
- name: Set up Go tool cache
uses: actions/[email protected]
with:
path: |
~/.devbox/go
key: devbox-go-tools.cache-${{ runner.arch }}-${{ hashFiles('Makefile') }}
- name: Build
run: make build
- name: Set up container image for generate
uses: ScribeMD/[email protected]
with:
key: docker-python-${{ runner.os }}-${{ hashFiles('.github/workflows/generate-python.yml') }}
- name: Set up Layout cache for generated files
uses: actions/[email protected]
with:
path: |
offsets-python
key: python-layout-${{ runner.os }}-${{ hashFiles('.github/workflows/generate-python.yml') }}
restore-keys: |
python-layout-${{ runner.os }}-
- name: Generate python Offsets for ${{ matrix.python-version }}
run: |
export python_version="${{ matrix.python-version }}"
if ! ls python-binaries/${{ matrix.python-version }}/libpython"${python_version%.*}"*.so.1.0 1> /dev/null 2>&1; then
mkdir -p python-binaries/${{ matrix.python-version }}
docker run --rm -v "${PWD}"/python-binaries/${{ matrix.python-version }}:/tmp -w /tmp docker://python:v${{ matrix.python-version }} bash -c 'cp /usr/local/lib/libpython"${python_version%.*}"*.so.1.0 /tmp'
fi
./structlayout -r python -v ${{ matrix.python-version }} -o offsets-python python-binaries/libpython"${python_version%.*}"*.so.1.0
git add offsets-python
cp $(git diff --name-only --staged | xargs) offsets-python || echo "No new or modified files - offsets
are up to date"
- name: Upload Offsets
uses: actions/upload-artifact@v3
with:
if-no-files-found: ignore
name: python-${{ matrix.python-version }}
path: offsets-python
create-branch:
runs-on: ubuntu-latest
needs: generate
if: github.event.pull_request.merged == true
steps:
- name: Check out the code
uses: actions/[email protected]
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Setup devbox
run: devbox run -- echo "done!"
- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
direnvVersion: 2.32.3
- name: Set up Go tool cache
uses: actions/[email protected]
with:
path: |
~/.devbox/go
key: devbox-go-tools.cache-${{ runner.arch }}-${{ hashFiles('Makefile') }}
- name: Build
run: make build
- uses: actions/download-artifact@v3
with:
name: offsets-${{ matrix.python-version }}
path: offsets-python
- name: Merge offsets
run: ./mergelayout -o pkg/python/versions offsets-python
# If there are no changes (i.e. no diff exists with the checked-out base branch),
# no pull request will be created and the action exits silently.
- name: Create a pull-request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update python layout"
title: "chore: update python layout"
body: This PR updates the python layout.
branch: update-python-offsets-${{ github.run_number }}
base: main
labels: chore
draft: false
maintainer-can-modify: true