Skip to content

Update pbuilder cache once a day #89

Update pbuilder cache once a day

Update pbuilder cache once a day #89

name: Update pbuilder cache once a day
on:
schedule:
# 04:00 AM (KST) Mon-Fri
- cron: "00 19 * * 0-4"
# Allow manually triggering the workflow
workflow_dispatch:
jobs:
cache_pbuilder:
strategy:
matrix:
os: [ ubuntu-22.04 ]
arch: [ amd64 ]
include:
- distroname: jammy
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v1
- name: make cache dir for pbuilder
## prevent permission error
run: sudo mkdir --mode a=rwx --parents /var/cache/pbuilder
- name: prepare pdebuild
run: |
echo "Installing build tools"
sudo add-apt-repository ppa:nnstreamer/ppa
echo "::group::apt-get update && apt-get install"
sudo apt-get update && sudo apt-get install -y pbuilder debootstrap curl ubuntu-dev-tools qemu-user-static debian-archive-keyring ubuntu-keyring debhelper
echo "::endgroup::"
echo "DISTRIBUTION=${{ matrix.distroname }}" > ~/.pbuilderrc
echo "OTHERMIRROR=\"deb [trusted=yes] http://archive.ubuntu.com/ubuntu ${{ matrix.distroname }}-backports universe |deb [trusted=yes] http://ppa.launchpad.net/nnstreamer/ppa/ubuntu ${{ matrix.distroname }} main\"" >> ~/.pbuilderrc
cat ~/.pbuilderrc
sudo mkdir -p /root/
sudo ln -s ~/.pbuilderrc /root/
- name: get date
id: get-date
run: |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: make pbuilder base.tgz
run: |
echo "=== pbuilder create"
echo "::group::pbuilder create --allow-untrusted"
sudo pbuilder create --allow-untrusted
echo "::endgroup::"
echo "=== pbuilder update"
echo "::group::pbuilder update --distribution ${{ matrix.distroname }}"
sudo pbuilder update --distribution ${{ matrix.distroname }}
echo "::endgroup"
echo "::group::pbuilder update"
sudo pbuilder update
echo "::endgroup"
- name: run pdebuild
id: pdebuild
run: |
mkdir -p ~/daily_build/ubuntu
pdebuild --logfile ~/daily_build/pdebuild_log.txt --buildresult ~/daily_build/ubuntu --architecture ${{ matrix.arch }} -- --distribution ${{ matrix.distroname }}
- name: save pbuilder cache
uses: actions/cache/save@v4
if: always() && github.ref == 'refs/heads/main'
with:
path: |
/var/cache/pbuilder/aptcache
/var/cache/pbuilder/base.tgz
key: pbuilder-cache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('**/debian/control') }}-${{ steps.get-date.outputs.date }}
- name: generate badge
run: |
pip install pybadges setuptools
if [ '${{ steps.pdebuild.outcome }}' == 'success' ]; then
python3 -m pybadges --left-text=test --right-text=success --right-color=green > ~/daily_build/pdebuild_result.svg
else
python3 -m pybadges --left-text=test --right-text=failure --right-color=red > ~/daily_build/pdebuild_result.svg
fi
- name: Release daily build result to release.nnstreamer.com
if: steps.pdebuild.outcome == 'success'
uses: ./.github/actions/s3_upload
with:
source: ~/daily_build/ubuntu/
dest: ubuntu/
s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
s3_option: --recursive
- name: Release daily build log to release.nnstreamer.com
uses: ./.github/actions/s3_upload
with:
source: ~/daily_build/pdebuild_log.txt
dest: logs/
s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
- name: update daily result badge
uses: ./.github/actions/gitpush
with:
source: ~/daily_build/pdebuild_result.svg
dest: testresult
message: "${{ steps.get-date.outputs.date }} : Update ubuntu daily build result."
taos_account: ${{ secrets.TAOS_ACCOUNT }}
taos_account_token: ${{ secrets.TAOS_ACCOUNT_TOKEN }}