[test]: repo: use dev repo #202
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
name: mkimg-th1520-ci | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
env: | |
ARCH: riscv | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
env: | |
CREATE_TARBALL: common_revyos_rootfs.tar | |
steps: | |
- name: Install Software | |
run: | | |
sudo apt update && \ | |
sudo apt install -y gdisk dosfstools build-essential autoconf automake autotools-dev ninja-build make \ | |
libncurses-dev gawk flex bison openssl libssl-dev tree \ | |
gcc-riscv64-linux-gnu gfortran-riscv64-linux-gnu libgomp1-riscv64-cross \ | |
qemu-user-static binfmt-support mmdebstrap | |
wget https://mirror.iscas.ac.cn/revyos/revyos-addons/pool/main/r/revyos-keyring/revyos-keyring_2023.06.12_all.deb | |
sudo apt install ./revyos-keyring_2023.06.12_all.deb | |
- name: Checkout qemu | |
uses: actions/checkout@v4 | |
with: | |
repository: revyos/qemu | |
path: qemu | |
ref: ab8f84892a89feea60f1bb24432ff58ce6d2885c # TODO: remove this line | |
- name: build qemu | |
run: | | |
pushd qemu | |
./configure \ | |
--prefix=$HOME/qemu-install \ | |
--static \ | |
--target-list=riscv64-linux-user \ | |
--disable-system \ | |
--disable-pie \ | |
--interp-prefix=/etc/qemu-binfmt/%M | |
make -j$(nproc) | |
make install | |
sudo cp -fv $HOME/qemu-install/bin/qemu-riscv64 /usr/bin/qemu-riscv64-static | |
popd | |
ls -al /usr/bin/qemu-riscv64-static | |
sudo dpkg-reconfigure binfmt-support | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: qemu-riscv64-static-ci | |
path: /usr/bin/qemu-riscv64-static | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
path: 'mkimg-th1520' # TODO: make this name a global variable | |
- name: Make rootfs tarball | |
run: | | |
pushd mkimg-th1520 | |
sudo -E ./mkrootfs.sh | |
mv ${CREATE_TARBALL} ../ | |
popd | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: common_revyos_rootfs | |
path: ${{ env.CREATE_TARBALL }} | |
mkrootfs: | |
needs: prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
model: [lpi4a, ahead, console, laptop, lpi4amain, meles] | |
runs-on: ubuntu-22.04 | |
env: | |
BOARD: ${{ matrix.model }} | |
steps: | |
- name: Run Configuration Commands | |
run: | | |
DATESTAMP="$(date --utc '+%Y.%m.%d')" | |
echo "Version: ${DATESTAMP}" | |
# Setup Artifacts Directory | |
ARTIFACTS_DIR="/opt/artifacts/" | |
mkdir -p $ARTIFACTS_DIR | |
# Setup environment variables | |
echo "DATESTAMP=${DATESTAMP}" >> $GITHUB_ENV | |
echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> $GITHUB_ENV | |
shell: bash | |
- name: Create Timestamp | |
run: | | |
echo "BUILD_ID=$(date +%Y%m%d_%H%M%S)" >> $GITHUB_ENV | |
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV | |
- name: Install Software | |
run: | | |
sudo apt update && \ | |
sudo apt install -y gdisk dosfstools build-essential autoconf automake autotools-dev ninja-build make \ | |
libncurses-dev gawk flex bison openssl libssl-dev tree \ | |
gcc-riscv64-linux-gnu gfortran-riscv64-linux-gnu libgomp1-riscv64-cross \ | |
qemu-user-static binfmt-support mmdebstrap libconfuse-dev mtools | |
wget https://mirror.iscas.ac.cn/revyos/revyos-addons/pool/main/r/revyos-keyring/revyos-keyring_2023.06.12_all.deb | |
sudo apt install ./revyos-keyring_2023.06.12_all.deb | |
- name: Download Built Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: Configure QEMU | |
run: | | |
tree ${ARTIFACTS_DIR}/ | |
sudo cp -vf ${ARTIFACTS_DIR}/qemu-riscv64-static-ci/qemu-riscv64-static /usr/bin/qemu-riscv64-static | |
sudo chmod a+x /usr/bin/qemu-riscv64-static | |
ls -al /usr/bin/qemu-riscv64-static | |
sudo dpkg-reconfigure binfmt-support | |
echo "USE_TARBALL=${ARTIFACTS_DIR}/common_revyos_rootfs/common_revyos_rootfs.tar" >> $GITHUB_ENV | |
- name: Checkout genimage | |
uses: actions/checkout@v4 | |
with: | |
repository: pengutronix/genimage | |
path: genimage | |
ref: v17 | |
- name: build genimage | |
run: | | |
pushd genimage | |
./autogen.sh | |
./configure | |
make -j$(nproc) | |
sudo make install | |
popd | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
path: 'mkimg-th1520' # TODO: make this name a global variable | |
- name: Make Image | |
run: | | |
# make revyos-release on CI | |
pushd mkimg-th1520 | |
echo "BUILD_ID=${{ env.BUILD_ID }}" >> revyos-release | |
echo "BUILD_DATE=${{ env.BUILD_DATE }}" >> revyos-release | |
echo "BOARD_NAME=${{ env.BOARD }}" >> revyos-release | |
echo "RELEASE_ID=${{ github.ref_name }}" >> revyos-release | |
echo "COMMIT_ID=${{ github.sha }}" >> revyos-release | |
echo "RUNNER_ID=${{ github.run_id }}" >> revyos-release | |
sudo -E ./mkrootfs.sh | |
popd | |
- name: Make Checksum file & Compress files | |
run: | | |
pushd mkimg-th1520 | |
zstd *.ext4 | |
zstd *.img | |
sha256sum *.zst > SHA256SUMS | |
sha512sum *.zst > SHA512SUMS | |
popd | |
- name: 'Upload Artifact EMMC' | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 30 | |
name: th1520-${{ env.BOARD }}-${{ env.BUILD_ID }} | |
path: | | |
mkimg-th1520/*.ext4.zst | |
mkimg-th1520/SHA256SUMS | |
mkimg-th1520/SHA512SUMS | |
- name: 'Upload Artifact SDCARD' | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 30 | |
name: th1520-sdcard-${{ env.BOARD }}-${{ env.BUILD_ID }} | |
path: | | |
mkimg-th1520/*.img.zst | |
mkimg-th1520/SHA256SUMS | |
mkimg-th1520/SHA512SUMS | |
- name: 'Upload Release' | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
mkimg-th1520/*.zst | |
token: ${{ secrets.GITHUB_TOKEN }} | |
upload_checksum: | |
needs: mkrootfs | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Download Built Artifacts | |
uses: actions/download-artifact@v4 | |
- name: Make Checksum file | |
run: | | |
find . -name "*.zst" | xargs -I{} mv -v {} . | |
sha256sum *.zst > SHA256SUMS | |
sha512sum *.zst > SHA512SUMS | |
- name: 'Upload checksum' | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
SHA256SUMS | |
SHA512SUMS | |
token: ${{ secrets.GITHUB_TOKEN }} |