Skip to content

Commit

Permalink
Merge branch 'master' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapona authored Jul 25, 2024
2 parents 2d1e46c + 6189d9f commit d0c12f2
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 21 deletions.
63 changes: 55 additions & 8 deletions .github/workflows/deb-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- bullseye
workflow_dispatch:

env:
Expand All @@ -14,38 +15,81 @@ env:
CHANGELOG_AUTHOR_EMAIL: "[email protected]"
PACKAGECLOUD_REPO: "experimental"
OS: "debian"
DISTROS: "\"distro\":[\"bookworm\", \"bullseye\"]"
HOST_COMPILE: "\"architecture\":[\"amd64\"]"
X_COMPILE: "\"architecture\":[\"armhf\", \"arm64\"]" # ARM 32 and 64 bit

jobs:
check-architecture:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
architecture: ${{ steps.set-arch.outputs.architecture }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Determine target architecture
id: set-matrix
id: set-arch
# If any packages define architecture as other than 'all'
# then it can't be compiled on host architecture
run: |
architecture=$HOST_COMPILE
if grep '^Architecture:' debian/control | grep -q -v 'all'; then
architecture=$X_COMPILE
fi
echo "matrix={$architecture, $DISTROS}">>$GITHUB_OUTPUT
echo "Building for $architecture"
echo "architecture=$architecture">>$GITHUB_OUTPUT
check-distro:
runs-on: ubuntu-20.04
outputs:
distros: ${{ steps.set-distros.outputs.distros }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Determine build distro
id: set-distros
run: |
distros="\"distro\":[\"bookworm\", \"bullseye\"]"
# if bullseye branch exists, build for bookworm only
if git branch -r | grep -Eq "origin/bullseye$"; then
distros="\"distro\":[\"bookworm\"]"
fi
# if pull request to bullseye branch or current branch is bullseye, build only for bullseye
if [ $(echo ${{ github.head_ref }} | grep -qE "bullseye$") ] || [ ${{ github.ref }} = 'refs/heads/bullseye' ]; then
distros="\"distro\":[\"bullseye\"]"
fi
echo "Building for $distros"
echo "distros=$distros">>$GITHUB_OUTPUT
set-build-matrix:
needs: [check-distro, check-architecture]
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Determine build matrix
id: set-matrix
run: |
matrix='{${{needs.check-distro.outputs.distros}}, ${{needs.check-architecture.outputs.architecture}}}'
echo "Building for $matrix"
echo "matrix=$matrix">>$GITHUB_OUTPUT
build-debian-package:
needs: check-architecture
runs-on: ubuntu-20.04
needs: set-build-matrix
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.check-architecture.outputs.matrix)}}
matrix: ${{fromJSON(needs.set-build-matrix.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -116,7 +160,10 @@ jobs:
# Only 1 .dsc is required for source so take armhf if there's multiple
if: |
(
github.ref == 'refs/heads/master' &&
(
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/bullseye'
) &&
(
matrix.architecture == 'amd64' ||
matrix.architecture == 'armhf'
Expand All @@ -131,7 +178,7 @@ jobs:

- name: Upload .deb to PackageCloud
uses: pi-top/ghaction-packagecloud@main
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/bullseye'
with:
repository: ${{ env.PACKAGECLOUD_REPO }}/${{ env.OS }}/${{ matrix.distro }}
files: |
Expand Down
79 changes: 68 additions & 11 deletions .github/workflows/deb-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: Create GitHub Release

on:
workflow_dispatch:
branches:
- master
pull_request:
branches:
- master
- bullseye
types: [closed]


Expand All @@ -15,33 +14,77 @@ env:
DEB_BUILD_DOCKER_BRANCH: "master"
PACKAGECLOUD_REPO: "pi-top-os-unstable"
OS: "debian"
DISTROS: "\"distro\":[\"bookworm\", \"bullseye\"]"
HOST_COMPILE: "\"architecture\":[\"amd64\"]"
X_COMPILE: "\"architecture\":[\"armhf\", \"arm64\"]" # ARM 32 and 64 bit

jobs:
check-architecture:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
architecture: ${{ steps.set-arch.outputs.architecture }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Determine target architecture
id: set-matrix
id: set-arch
# If any packages define architecture as other than 'all'
# then it can't be compiled on host architecture
run: |
architecture=$HOST_COMPILE
if grep '^Architecture:' debian/control | grep -q -v 'all'; then
architecture=$X_COMPILE
fi
echo "matrix={$architecture, $DISTROS}">>$GITHUB_OUTPUT
echo "Building for $architecture"
echo "architecture=$architecture">>$GITHUB_OUTPUT
check-distro:
runs-on: ubuntu-20.04
outputs:
distros: ${{ steps.set-distros.outputs.distros }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Determine build distro
id: set-distros
run: |
distros="\"distro\":[\"bookworm\", \"bullseye\"]"
# if bullseye branch exists, build for bookworm only
if git branch -r | grep -Eq "origin/bullseye$"; then
distros="\"distro\":[\"bookworm\"]"
fi
# if pull request to bullseye branch or current branch is bullseye, build only for bullseye
if [ $(echo ${{ github.head_ref }} | grep -qE "bullseye$") ] || [ ${{ github.ref }} = 'refs/heads/bullseye' ]; then
distros="\"distro\":[\"bullseye\"]"
fi
echo "Building for $distros"
echo "distros=$distros">>$GITHUB_OUTPUT
set-build-matrix:
needs: [check-distro, check-architecture]
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Determine build matrix
id: set-matrix
run: |
matrix='{${{needs.check-distro.outputs.distros}}, ${{needs.check-architecture.outputs.architecture}}}'
echo "Building for $matrix"
echo "matrix=$matrix">>$GITHUB_OUTPUT
check-versions:
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged && github.head_ref == 'bump-changelog')
runs-on: ubuntu-20.04
outputs:
CURRENT_VERSION: ${{ steps.current_version.outputs.CURRENT_VERSION }}
Expand Down Expand Up @@ -75,12 +118,12 @@ jobs:
echo "CURRENT_VERSION=${{ env.CURRENT_VERSION }}">>"$GITHUB_OUTPUT"

release:
needs: [check-architecture, check-versions]
needs: [set-build-matrix, check-versions]
runs-on: ubuntu-20.04
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged && github.head_ref == 'bump-changelog')
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.check-architecture.outputs.matrix)}}
matrix: ${{fromJSON(needs.set-build-matrix.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -121,12 +164,14 @@ jobs:
# Only 1 .dsc is required for source so take armhf if there's multiple
if: |
(
github.ref == 'refs/heads/master' &&
(
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/bullseye'
) &&
(
matrix.architecture == 'amd64' ||
matrix.architecture == 'armhf'
)
)
with:
repository: ${{ env.PACKAGECLOUD_REPO }}/${{ env.OS }}/${{ matrix.distro }}
Expand All @@ -152,9 +197,21 @@ jobs:
ls -l ./artifacts
zip ${{ matrix.distro }}-${{ matrix.architecture }}.deb.zip ./artifacts/*
- name: Set release tag
run: |
release_tag="v${{ needs.check-versions.outputs.CURRENT_VERSION }}"
matrix="${{needs.set-build-matrix.outputs.matrix}}"
# if releasing ONLY for bullseye, prepend 'bullseye' to release tag
if [ ${{ matrix.distro }} = 'bullseye' ] && echo "${matrix}" | grep -qv 'bookworm'; then
release_tag="bullseye-$release_tag"
fi
echo "RELEASE_TAG=${release_tag}" >> $GITHUB_ENV
- name: Create release and upload package
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT_GITHUB }}
file: ./${{ matrix.distro}}-${{ matrix.architecture }}.deb.zip
tag: "v${{ needs.check-versions.outputs.CURRENT_VERSION }}"
tag: ${{ env.RELEASE_TAG }}
3 changes: 2 additions & 1 deletion .github/workflows/test-all-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ jobs:
coverage xml
- name: Upload Python test coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: python-tests
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion debian/pt-web-vnc-desktop.service
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[Unit]
Description=Shares desktop via VNC & HTTP
Documentation=https://knowledgebase.pi-top.com/knowledge
After=lightdm.service

[Service]
Type=simple
RemainAfterExit=yes
Restart=no
Restart=on-failure
ExecStart=/usr/bin/pt-web-vnc start --display-id 0
ExecStop=/usr/bin/pt-web-vnc stop --display-id 0

Expand Down

0 comments on commit d0c12f2

Please sign in to comment.