-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ubuntu build and test github action. Signed-off-by: Gichan Jang <[email protected]>
- Loading branch information
1 parent
f10366c
commit 408272c
Showing
2 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Build and unit test/ Pdebuild Ubuntu 22.04 | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
schedule: | ||
# 04:00 AM (KST) Mon-Fri | ||
- cron: "00 19 * * 0-4" | ||
|
||
# Allow manually triggering the workflow | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-22.04 ] | ||
arch: [ amd64 ] | ||
include: | ||
- distroname: jammy | ||
os: ubuntu-22.04 | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: -${{ github.event.pull_request.commits }} | ||
- name: Check if rebuild required | ||
uses: ./.github/actions/check-rebuild | ||
with: | ||
mode: build | ||
- uses: actions/setup-python@v5 | ||
|
||
- name: Check trigger event | ||
id: rebuild | ||
run: | | ||
if ${{ env.rebuild == '1' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}; then | ||
echo "rebuild=1" >> $GITHUB_OUTPUT | ||
else | ||
echo "rebuild=0" >> $GITHUB_OUTPUT | ||
fi | ||
- name: get date | ||
id: get-date | ||
run: | | ||
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
- name: make cache dir for pbuilder | ||
## prevent permission error | ||
run: sudo mkdir --mode a=rwx --parents /var/cache/pbuilder | ||
|
||
- name: restore pbuilder cache for pull-request | ||
id: restore-pbuilder-cache | ||
if: env.rebuild == '1' && github.event_name == 'pull_request' | ||
uses: actions/cache/restore@v4 | ||
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 }} | ||
restore-keys: | | ||
pbuilder-cache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('**/debian/control') }}- | ||
pbuilder-cache-${{ matrix.os }}-${{ matrix.arch }}- | ||
- name: prepare pdebuild | ||
if: steps.rebuild.outputs.rebuild == '1' | ||
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: make pbuilder base.tgz | ||
if: ${{ steps.rebuild.outputs.rebuild == '1' && steps.restore-pbuilder-cache.outputs.cache-hit != 'true' }} | ||
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 | ||
if: steps.rebuild.outputs.rebuild == '1' | ||
id: pdebuild | ||
continue-on-error: true | ||
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 | ||
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} | ||
uses: actions/cache/save@v4 | ||
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 }} |
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