ci: spilt make rootfs tarball to prepare #133
Workflow file for this run
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@v3 | |
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 | |
popd | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: common_revyos_rootfs | |
path: ${{ env.CREATE_TARBALL }} | |
mkrootfs: | |
needs: prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
model: [lpi4a, ahead, console, 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 | |
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@v2 | |
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 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 | |
sha256sum *.ext4 > SHA256SUMS | |
sha512sum *.ext4 > SHA512SUMS | |
zstd *.ext4 | |
popd | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
retention-days: 30 | |
name: th1520-${{ env.BOARD }}-${{ env.BUILD_ID }} | |
path: | | |
mkimg-th1520/*.ext4.zst | |
mkimg-th1520/SHA256SUMS | |
mkimg-th1520/SHA512SUMS | |
- name: 'Create release by tag' | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
mkimg-th1520/*.ext4.zst | |
mkimg-th1520/SHA256SUMS | |
mkimg-th1520/SHA512SUMS | |
token: ${{ secrets.GITHUB_TOKEN }} |