dep: Bump PyPy to 7.3.17 #113
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build PyPy | |
on: | |
push: | |
branches: | |
- '**' | |
paths: | |
- 'builder/**' | |
- '.github/workflows/build-pypy.yml' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
env: | |
ALPINE_VERSION: 3.19 | |
BUILDER_IMAGE_TAG: ghcr.io/cyb3r-jak3/alpine-pypy-builder-workflow | |
PYPY_VERSION: 7.3.17 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
Prep: | |
runs-on: ubuntu-latest | |
name: Prep Docker Container | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login To GitHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: "builder/" | |
tags: ${{ env.BUILDER_IMAGE_TAG }}:${{ env.ALPINE_VERSION }}-${{ github.sha }} | |
build-args: | | |
BUILD_IMAGE=ghcr.io/cyb3r-jak3/alpine-pypy:2.7-7.3.14-3.19 | |
cache-to: type=gha,mode=max,scope=buildx-alpine-pypy-workflow-builder:${{ env.ALPINE_VERSION }} | |
cache-from: type=gha,scope=buildx-alpine-pypy-workflow-builder:${{ env.ALPINE_VERSION }} | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
Build: | |
runs-on: ${{ matrix.RUNNER }} | |
name: Run Container | |
needs: Prep | |
strategy: | |
fail-fast: true | |
matrix: | |
PYPY_BASE: ["2.7", "3.9", "3.10"] | |
RUNNER: ["self-hosted", "ubuntu-latest"] | |
steps: | |
- name: Setup Platforms | |
env: | |
RUNS_ON: ${{ matrix.RUNNER }} | |
shell: python | |
run: | | |
import os | |
if os.environ["RUNS_ON"] == "self-hosted": | |
with open(os.environ['GITHUB_ENV'], 'a') as fh: | |
print('ARCH=arm64', file=fh) | |
print('PYPY_ARCH=aarch64', file=fh) | |
else: | |
with open(os.environ['GITHUB_ENV'], 'a') as fh: | |
print('ARCH=amd64', file=fh) | |
print('PYPY_ARCH=x86_64', file=fh) | |
- name: Check if file and signature already exists | |
id: file-check | |
shell: python | |
run: | | |
import os | |
import requests | |
base_url = "https://pypy.cyberjake.xyz/pypy/${{ matrix.PYPY_BASE }}/pypy${{ matrix.PYPY_BASE }}-v${{ env.PYPY_VERSION }}-linux-${{ env.PYPY_ARCH }}-alpine.tar.bz2" | |
file_resp = requests.head(base_url) | |
signature_resp = requests.head(f"{base_url}.sig") | |
if file_resp.status_code == 404 or signature_resp.status_code == 404: | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | |
print('STATUS=404', file=fh) | |
- name: Login To GitHub | |
if: steps.file-check.outputs.STATUS == 404 | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
if: steps.file-check.outputs.STATUS == 404 | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: steps.file-check.outputs.STATUS == 404 | |
uses: docker/setup-buildx-action@v3 | |
- name: Run Build | |
if: steps.file-check.outputs.STATUS == 404 | |
run: | | |
PYPY_SHA256SUM=$(curl -s https://api.cyberjake.xyz/pypy/checksums/pypy${{ matrix.PYPY_BASE }}-v${{ env.PYPY_VERSION }}-src.tar.bz2 | jq --raw-output .results[0].checksum) | |
echo "${PYPY_SHA256SUM}" | |
docker run --platform linux/${{ env.ARCH }} -v $(pwd)/tmp:/tmp -e PYPY_BASE=${{ matrix.PYPY_BASE }} -e PYPY_VERSION=${{ env.PYPY_VERSION }} -e PYPY_SHA256SUM="${PYPY_SHA256SUM}" ${{ env.BUILDER_IMAGE_TAG }}:${{ env.ALPINE_VERSION }}-${{ github.sha }} | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
if: steps.file-check.outputs.STATUS == 404 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
trust_level: 5 | |
- name: Prep files | |
if: steps.file-check.outputs.STATUS == 404 | |
run: | | |
wget --quiet -O sign.py https://raw.githubusercontent.com/Cyb3r-Jak3/docker-alpine-pypy/${{ github.sha }}/.github/sign.py | |
mkdir output | |
mv ./tmp/usession-release-pypy${{ matrix.PYPY_BASE }}-v${{ env.PYPY_VERSION }}-*/build/**.tar.bz2 ./output/pypy${{ matrix.PYPY_BASE }}-v${{ env.PYPY_VERSION }}-linux-${{ env.PYPY_ARCH }}-alpine.tar.bz2 | |
find ./output/ -type f -exec python3 sign.py {} \; | |
- name: Upload PyPy to Artifacts | |
if: steps.file-check.outputs.STATUS == 404 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypy-${{ env.ARCH }}-${{ matrix.PYPY_BASE }}-${{ env.PYPY_VERSION }} | |
path: ./output | |
- name: Clean files | |
if: steps.file-check.outputs.STATUS == 404 | |
run: | | |
rm -rf output/ | |
rm -rf tmp/ | |
Upload: | |
runs-on: ubuntu-latest | |
name: Upload PyPy builds | |
needs: Build | |
steps: | |
- name: Download upload script | |
run: | | |
wget --quiet -O upload.py https://raw.githubusercontent.com/Cyb3r-Jak3/docker-alpine-pypy/${{ github.sha }}/.github/upload.py | |
pip install boto3==1.34.90 | |
- name: Download PyPy builds | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: 'pypy-*' | |
merge-multiple: true | |
path: ./output | |
- name: Upload PyPy builds | |
run: | | |
python upload.py | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |