Skip to content

Commit e6b9b86

Browse files
committed
GitHub workflows & setup: add support for dietpi:rpi_armv6_buster base image.
1 parent 4d34ebf commit e6b9b86

File tree

8 files changed

+480
-297
lines changed

8 files changed

+480
-297
lines changed
File renamed without changes.

.github/workflows/arm-runner.yml

Lines changed: 130 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7,85 +7,147 @@ on:
77
- 'fx[0-9]+.[0-9]+.[0-9]+*'
88
branches:
99
- 'releng'
10+
1011
jobs:
11-
test:
12+
test_suite:
13+
name: Run test suite
1214
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
base_image: ['raspios_lite:2021-05-07', 'dietpi:rpi_armv6_buster']
19+
1320
steps:
14-
- uses: actions/checkout@v2
15-
- name: Run tests in chroot environment
16-
uses: pguyot/arm-runner-action@v1
17-
id: arm_runner_tests
18-
with:
19-
image_additional_mb: 3584
20-
base_image: 'raspios_lite:2021-05-07'
21-
cpu: 'arm1176'
22-
copy_repository_path: /home/pi/pynab
23-
commands: |
24-
sudo chown -R pi:pi /home/pi/pynab
21+
- name: Checkout pynab
22+
uses: actions/checkout@v2
23+
24+
- name: Run test suite in chroot environment
25+
uses: pguyot/arm-runner-action@v1
26+
id: arm_runner_tests
27+
with:
28+
image_additional_mb: 4096
29+
base_image: ${{ matrix.base_image }}
30+
cpu: 'arm1176'
31+
copy_repository_path: /home/pi/pynab
32+
commands: |
33+
sudo useradd pi || true
34+
sudo sh -c "[ ! -f /etc/sudoers.d/010_pi-nopasswd ] && usermod -aG sudo pi && echo 'pi ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/010_pi-nopasswd || true"
35+
sudo chown -hR pi:pi /home/pi/pynab
2536
sudo apt-get update -y
2637
sudo apt-get install --no-install-recommends -y postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran3 libopenblas-dev liblapack-dev zram-tools
2738
sudo mkdir -p /run/systemd/timesync/ && sudo touch /run/systemd/timesync/synchronized
39+
sudo apt-get install --no-install-recommends -y alsa-utils xz-utils avahi-daemon
2840
sudo -u pi taskset -c 0 /bin/bash install.sh ci-chroot-test
29-
- name: Upload image if tests failed
30-
uses: actions/upload-artifact@v2
31-
if: failure()
32-
with:
33-
name: Image of failed tests
34-
path: ${{ steps.arm_runner_tests.outputs.image }}
41+
3542
create_image:
36-
needs: test
43+
name: Build image
3744
runs-on: ubuntu-latest
45+
needs: test_suite
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
base_image: ['raspios_lite:2021-05-07', 'dietpi:rpi_armv6_buster']
3850
if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/')
51+
3952
steps:
40-
- uses: actions/checkout@v2
41-
- name: Define the image name
42-
id: image_and_branch_name
43-
run: |
44-
if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then
45-
echo ::set-output name=LOCAL_BRANCH::${GITHUB_REF/refs\/tags\//}
46-
echo ::set-output name=IMAGE_NAME_SUFFIX::${GITHUB_REF/refs\/tags\//}
47-
elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then
48-
echo ::set-output name=LOCAL_BRANCH::releng
49-
echo ::set-output name=IMAGE_NAME_SUFFIX::releng
50-
else
51-
echo ::set-output name=LOCAL_BRANCH::${GITHUB_REF/refs\/heads\//}
52-
fi
53-
- name: Create a release image in chroot environment
54-
uses: pguyot/arm-runner-action@v1
55-
id: arm_runner_install
56-
with:
57-
image_additional_mb: 3584
58-
base_image: 'raspios_lite:2021-05-07'
59-
cpu: 'arm1176'
60-
commands: |
53+
- name: Checkout pynab
54+
uses: actions/checkout@v2
55+
56+
- name: Define the image name
57+
id: image_and_branch_name
58+
run: |
59+
if [[ "${{ matrix.base_image }}" =~ "raspios" ]]; then
60+
os_suffix="-raspios"
61+
elif [[ "${{ matrix.base_image }}" =~ "dietpi" ]]; then
62+
os_suffix="-dietpi"
63+
else
64+
os_suffix=""
65+
fi
66+
if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then
67+
echo ::set-output name=LOCAL_BRANCH::${GITHUB_REF/refs\/tags\//}
68+
echo ::set-output name=RELEASE_NAME::${GITHUB_REF/refs\/tags\//}
69+
echo ::set-output name=IMAGE_NAME_SUFFIX::${GITHUB_REF/refs\/tags\//}${os_suffix}
70+
elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then
71+
echo ::set-output name=LOCAL_BRANCH::releng
72+
echo ::set-output name=RELEASE_NAME::releng
73+
echo ::set-output name=IMAGE_NAME_SUFFIX::releng${os_suffix}
74+
else
75+
echo ::set-output name=LOCAL_BRANCH::${GITHUB_REF/refs\/heads\//}
76+
fi
77+
78+
- name: Create a release image in chroot environment
79+
uses: pguyot/arm-runner-action@v1
80+
id: arm_runner_install
81+
with:
82+
image_additional_mb: 4096
83+
base_image: ${{ matrix.base_image }}
84+
cpu: 'arm1176'
85+
commands: |
6186
echo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }}
6287
echo GITHUB_REPOSITORY=${{ github.repository }}
63-
sudo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }} GITHUB_REPOSITORY=${{ github.repository }} /bin/bash setup
64-
sudo rm -rf /pynab
65-
sudo apt-get autoremove -y
88+
sudo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }} GITHUB_REPOSITORY=${{ github.repository }} /bin/bash setup ci-chroot
89+
cd / ; sudo rm -rf /pynab
90+
sudo apt-get autoremove --purge -y
6691
sudo apt-get clean
67-
- name: Compress the release image with PiShrink
68-
run: |
69-
mv ${{ steps.arm_runner_install.outputs.image }} pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
70-
wget https://raw.githubusercontent.com/Drewsif/PiShrink/fa3c7a27406e7c0a1c7b8688e330f14a766be1ba/pishrink.sh
71-
sudo bash pishrink.sh -Z -a pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
72-
- name: Create release with releng image
73-
if: github.ref == 'refs/heads/releng'
74-
uses: "marvinpinto/[email protected]"
75-
with:
76-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
77-
automatic_release_tag: "latest"
78-
prerelease: true
79-
draft: true
80-
title: "Prerelease image"
81-
files: pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img.xz
82-
- name: Create release with release image
83-
if: startsWith(github.ref, 'refs/tags/')
84-
uses: "marvinpinto/[email protected]"
85-
with:
86-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
87-
automatic_release_tag: ${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}
88-
prerelease: false
89-
draft: true
90-
title: ${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}
91-
files: pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img.xz
92+
sudo sh -c 'cat /dev/zero >/boot/zero.fill 2>/dev/null; sync; rm -f /boot/zero.fill'
93+
sudo sh -c 'cat /dev/zero >/zero.fill 2>/dev/null; sync; rm -f /zero.fill'
94+
95+
96+
- name: Compress the release image with PiShrink
97+
run: |
98+
mv ${{ steps.arm_runner_install.outputs.image }} pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
99+
wget https://raw.githubusercontent.com/Drewsif/PiShrink/fa3c7a27406e7c0a1c7b8688e330f14a766be1ba/pishrink.sh
100+
sudo bash pishrink.sh -s -Z -a -p pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
101+
102+
- name: Upload the image artifact
103+
uses: actions/upload-artifact@v2
104+
with:
105+
name: release_images
106+
path: pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img.xz
107+
if-no-files-found: error
108+
retention-days: 1
109+
110+
create_release:
111+
name: Release
112+
runs-on: ubuntu-latest
113+
needs: create_image
114+
if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/')
115+
116+
steps:
117+
- name: Define the release name
118+
id: release_name
119+
run: |
120+
if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then
121+
echo ::set-output name=RELEASE_NAME::${GITHUB_REF/refs\/tags\//}
122+
elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then
123+
echo ::set-output name=RELEASE_NAME::releng
124+
else
125+
echo ::set-output name=RELEASE_NAME::${GITHUB_REF/refs\/heads\//}
126+
fi
127+
128+
- name: Download the image artifact(s)
129+
uses: actions/download-artifact@v2
130+
with:
131+
name: release_images
132+
133+
- name: Create release with releng image
134+
if: github.ref == 'refs/heads/releng'
135+
uses: "marvinpinto/[email protected]"
136+
with:
137+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
138+
automatic_release_tag: "latest"
139+
prerelease: true
140+
draft: true
141+
title: "Prerelease"
142+
files: pynab-${{ steps.release_name.outputs.RELEASE_NAME }}*.img.xz
143+
144+
- name: Create release with release image
145+
if: startsWith(github.ref, 'refs/tags/')
146+
uses: "marvinpinto/[email protected]"
147+
with:
148+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
149+
automatic_release_tag: ${{ steps.release_name.outputs.RELEASE_NAME }}
150+
prerelease: false
151+
draft: true
152+
title: ${{ steps.release_name.outputs.RELEASE_NAME }}
153+
files: pynab-${{ steps.release_name.outputs.RELEASE_NAME }}*.img.xz

.github/workflows/labeler.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
# This workflow will apply a label based on the
2-
# paths that are modified in the pull request.
3-
#
4-
# To use this workflow, you will need to set up a .github/labels.yml
5-
# file with configuration. For more information, see:
6-
# https://github.com/marketplace/actions/prow-github-actions
7-
81
name: 🏷️ Pull Request Labeler
92
on:
103
- pull_request_target
114

125
jobs:
13-
triage:
6+
pr_triage:
147
runs-on: ubuntu-latest
8+
159
steps:
16-
- uses: actions/labeler@main
10+
- name: Apply labels
11+
uses: actions/labeler@v3
1712
with:
1813
repo-token: "${{ secrets.GITHUB_TOKEN }}"
14+
configuration-path: .github/labels.yml
15+
sync-labels: true

0 commit comments

Comments
 (0)