1 name: Build and unit test/ Pdebuild Ubuntu 22.04
3 # ${{ github.event.pull_request.commits }} : # commits in this PR
4 # - changed_file_list in GITHUB_ENV: the list of files updated in this pull-request.
6 ## @todo apply "cache" to pdebuilder cache, or create docker images ready for pdebuild
15 runs-on: ${{ matrix.os }}
18 #os: [ ubuntu-20.04, ubuntu-22.04 ]
19 ## ppa/nnstreamer's ubuntu 20.04 has gpgv error:
20 # E: Release signed by unknown key (key id CADA0F77901522B3)
21 # The specified keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg may be incorrect or out of date.
22 # You can find the latest Debian release key at https://ftp-master.debian.org/keys.html
23 # E: debootstrap failed
24 # E: Tail of debootstrap.log:
26 # 2024-01-24 15:01:58 URL:http://ppa.launchpad.net/nnstreamer/ppa/ubuntu/dists/focal/InRelease [18035/18035] -> "/var/cache/pbuilder/build/10399/var/lib/apt/lists/partial/ppa.launchpad.net_nnstreamer_ppa_ubuntu_dists_focal_InRelease" [1]
27 # gpgv: Signature made Wed Jan 24 09:12:55 2024 UTC
28 # gpgv: using RSA key 373A37D40E480F96524A4027CADA0F77901522B3
29 # gpgv: Can't check signature: No public key
30 # E: End of debootstrap.log
31 # W: Aborting with an error
33 arch: [ amd64, arm64 ]
41 - uses: actions/checkout@v4
43 ref: ${{ github.event.pull_request.head.sha }}
44 fetch-depth: -${{ github.event.pull_request.commits }}
45 - name: Check if rebuild required
46 ## @todo This should become a reusable workflow.
49 git show --pretty="format:" --name-only --diff-filter=AMRC ${{ github.event.pull_request.head.sha}} -${{ github.event.pull_request.commits }} | sort | uniq | awk NF > ${tmpfile}
50 echo "changed_file_list=${tmpfile}" >> "$GITHUB_ENV"
51 rebuild=`bash .github/workflows/check_if_rebuild_requires.sh ${tmpfile} debian | grep "REBUILD=YES" | wc -l`
52 echo "Rebuild required: ${rebuild}"
53 echo "rebuild=${rebuild}" >> "$GITHUB_ENV"
54 - uses: actions/setup-python@v1
55 - name: make cache key
56 if: env.rebuild == '1'
58 run: echo "cache_key=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
60 - name: cache pbuilder cache
62 if: env.rebuild == '1'
63 uses: actions/cache@v3
65 path: /var/cache/pbuilder
66 key: ${{ steps.make-key.outputs.cache_key }}
67 - name: prepare pdebuild
68 if: env.rebuild == '1'
70 echo "Installing build tools"
71 sudo add-apt-repository ppa:nnstreamer/ppa
72 echo "::group::apt-get update && apt-get install"
73 sudo apt-get update && sudo apt-get install -y pbuilder debootstrap curl ubuntu-dev-tools qemu-user-static debian-archive-keyring ubuntu-keyring debhelper
75 echo "DISTRIBUTION=${{ matrix.distroname }}" > ~/.pbuilderrc
76 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
79 sudo ln -s ~/.pbuilderrc /root/
80 echo "=== pbuilder create"
81 echo "::group::pbuilder create --allow-untrusted"
82 sudo pbuilder create --allow-untrusted
84 echo "=== pbuilder update"
85 echo "::group::pbuilder update --distribution ${{ matrix.distroname }}"
86 sudo pbuilder update --distribution ${{ matrix.distroname }}
88 echo "::group::pbuilder update"
92 if: env.rebuild == '1'
94 pdebuild --architecture ${{ matrix.arch }} -- --distribution ${{ matrix.distroname }}