[BACKEND] Fix linux build cache (#470)

This commit is contained in:
Jesse Bannon 2023-02-23 12:26:20 -08:00 committed by GitHub
parent ea5b04435e
commit 486ee9d353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,9 @@ on:
branches: branches:
- master - master
pull_request: pull_request:
env:
ACTIONS_STEP_DEBUG: true
ACTIONS_RUNNER_DEBUG: true
jobs: jobs:
version: version:
name: version name: version
@ -60,19 +63,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: quay.io/pypa/manylinux_2_28_x86_64 image: quay.io/pypa/manylinux_2_28_x86_64
volumes:
- /opt/builds:/opt/builds
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Write version to init file - name: Write version to init file
run: | run: |
echo '${{ needs.version.outputs.init_contents }}' > src/ytdl_sub/__init__.py echo '${{ needs.version.outputs.init_contents }}' > src/ytdl_sub/__init__.py
- name: Install Python - name: Install base packages
run: | run: |
cat /etc/os-release cat /etc/os-release
dnf update -y dnf update -y
dnf install -y epel-release tar zstd dnf install -y epel-release tar wget make gcc openssl-devel bzip2-devel libffi-devel zlib-devel
dnf install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make - name: Install Python
run: |
wget https://www.python.org/ftp/python/3.10.10/Python-3.10.10.tar.xz wget https://www.python.org/ftp/python/3.10.10/Python-3.10.10.tar.xz
tar -xf Python-3.10.10.tar.xz tar -xf Python-3.10.10.tar.xz
cd Python-3.10.10 && ./configure --with-ensurepip=install --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" cd Python-3.10.10 && ./configure --with-ensurepip=install --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
@ -86,14 +88,15 @@ jobs:
# Build executable # Build executable
pyinstaller ytdl-sub.spec pyinstaller ytdl-sub.spec
mkdir -p /opt/builds mkdir -p /opt/builds
chmod +x dist/ytdl-sub chmod ugo+rwx dist/ytdl-sub
dist/ytdl-sub -h dist/ytdl-sub -h
mv dist/ytdl-sub /opt/builds/ytdl-sub_linux mv dist/ytdl-sub /opt/builds/ytdl-sub_linux
- name: Save build to cache
uses: actions/cache@v3 - name: Upload build
uses: actions/upload-artifact@v3
with: with:
name: ytdl-sub_linux
path: /opt/builds/ytdl-sub_linux path: /opt/builds/ytdl-sub_linux
key: ${{ github.sha }}-linux
build-arm: build-arm:
name: build-arm name: build-arm
@ -128,11 +131,11 @@ jobs:
mv dist/ytdl-sub /builds/ytdl-sub_${{ matrix.arch }} mv dist/ytdl-sub /builds/ytdl-sub_${{ matrix.arch }}
cd /builds && ./ytdl-sub_${{ matrix.arch }} -h cd /builds && ./ytdl-sub_${{ matrix.arch }} -h
- name: Save build to cache - name: Upload build
uses: actions/cache@v3 uses: actions/upload-artifact@v3
with: with:
name: ytdl-sub_${{ matrix.arch }}
path: /opt/builds/ytdl-sub_${{ matrix.arch }} path: /opt/builds/ytdl-sub_${{ matrix.arch }}
key: ${{ github.sha }}-${{ matrix.arch }}
################################################################################################## ##################################################################################################
@ -149,33 +152,33 @@ jobs:
run: | run: |
echo '${{ needs.version.outputs.init_contents }}' > src/ytdl_sub/__init__.py echo '${{ needs.version.outputs.init_contents }}' > src/ytdl_sub/__init__.py
- name: Restore linux build - name: Restore armv6 build
uses: actions/cache@v3 uses: actions/download-artifact@v3
with: with:
path: /opt/builds/ytdl-sub_linux name: ytdl-sub_armv6
key: ${{github.sha}}-linux path: /opt/builds/ytdl-sub_armv6
fail-on-cache-miss: True
- name: Restore aarch64 build
uses: actions/cache@v3
with:
path: /opt/builds/ytdl-sub_aarch64
key: ${{github.sha}}-aarch64
fail-on-cache-miss: True
- name: Restore armv7 build - name: Restore armv7 build
uses: actions/cache@v3 uses: actions/download-artifact@v3
with: with:
name: ytdl-sub_armv7
path: /opt/builds/ytdl-sub_armv7 path: /opt/builds/ytdl-sub_armv7
key: ${{github.sha}}-armv7
fail-on-cache-miss: True
- name: Restore armv6 build - name: Restore aarch64 build
uses: actions/cache@v3 uses: actions/download-artifact@v3
with: with:
path: /opt/builds/ytdl-sub_armv6 name: ytdl-sub_aarch64
key: ${{github.sha}}-armv6 path: /opt/builds/ytdl-sub_aarch64
fail-on-cache-miss: True
- name: Restore linux build
uses: actions/download-artifact@v3
with:
name: ytdl-sub_linux
path: /opt/builds/ytdl-sub_linux
- name: Inspect build directory
run: |
ls -lh /opt/builds
- name: Create Release - name: Create Release
if: ${{ github.ref == 'refs/heads/master' }} if: ${{ github.ref == 'refs/heads/master' }}