Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cip41 #5

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 206 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
name: build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "0 0 * * 5"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
prepare_container:
runs-on: self-hosted
outputs:
uid: ${{ steps.uid_step.outputs.userid }}
gid: ${{ steps.uid_step.outputs.groupid }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Get user id/group
id: uid_step
run: |
echo "userid=$(id -u)" >> "$GITHUB_OUTPUT"
echo "groupid=$(id -g)" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config: /etc/docker/cibuilder.toml

- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ciserver.ci:5000
username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }}
password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: docker
push: true
tags: ciserver.ci:5000/${{ github.repository_id }}:latest
cache-from: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache
cache-to: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache,mode=max
file: docker/Dockerfile

build_images:
needs: prepare_container
runs-on: self-hosted
container:
image: ciserver.ci:5000/${{ github.repository_id }}:latest
credentials:
username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }}
password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }}
options: --user "${{ needs.prepare_container.outputs.uid }}:${{ needs.prepare_container.outputs.gid }}"
outputs:
build_tag: ${{ steps.tag_step.outputs.build_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: true

- name: Fetch cache from server
uses: tespkg/actions-cache/restore@v1
with:
endpoint: ciserver.ci
port: 9000
insecure: true
accessKey: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secretKey: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cicache
use-fallback: false
key: ${{ github.repository }}
path: build/cache/cicache

- name: Get build tag
id: tag_step
run: |
build_tag=$(date +%Y-%m-%d)_$(git rev-parse --short HEAD)
echo "build_tag=$build_tag" >> "$GITHUB_OUTPUT"

- name: Register buildroot mirror
run: echo 'BR2_PRIMARY_SITE="http://ciserver.ci:8000/cimirror/buildroot_mirror"' >> configs/buildroot/rz-solidrun_defconfig

- name: Build for RZ/G2LC
shell: bash
run: |
COMPRESSION_FORMAT=xz MACHINE=rzg2lc-solidrun ./runme.sh
COMPRESSION_FORMAT=xz DISTRO=debian MACHINE=rzg2lc-solidrun ./runme.sh

- name: Build for RZ/G2L
shell: bash
run: |
COMPRESSION_FORMAT=xz MACHINE=rzg2l-solidrun ./runme.sh
COMPRESSION_FORMAT=xz DISTRO=debian MACHINE=rzg2l-solidrun ./runme.sh

- name: Build for RZ/V2L
shell: bash
run: |
COMPRESSION_FORMAT=xz MACHINE=rzv2l-solidrun ./runme.sh
COMPRESSION_FORMAT=xz DISTRO=debian MACHINE=rzv2l-solidrun ./runme.sh

- name: Copy deploy artifacts
shell: bash
run: |
mkdir deploy
cp images/*-bootloader-*.img deploy
cp images/*.img.xz deploy
cp images/*.img.bmap deploy

- name: Deploy to the local minio storage
uses: yakubique/[email protected]
with:
endpoint: http://ciserver.ci:9000
insecure: true
access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cipublish
source: ./deploy
target: "/${{ github.repository_id }}/${{ steps.tag_step.outputs.build_tag }}"
recursive: true

- name: Update cache on the server
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
uses: tespkg/actions-cache/save@v1
with:
endpoint: ciserver.ci
port: 9000
insecure: true
accessKey: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secretKey: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cicache
use-fallback: false
key: ${{ github.repository }}
path: build/cache/cicache

- name: Prepare mirror
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
shell: bash
run: |
mkdir buildroot_mirror
cp -r build/cache/buildroot_dl/* buildroot_mirror

- name: Update download mirror
uses: yakubique/[email protected]
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
with:
endpoint: http://ciserver.ci:9000
insecure: true
access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cimirror
source: buildroot_mirror
target: "/"
recursive: true

publish_images:
needs: build_images
runs-on: self-hosted
if: github.event_name == 'push'
steps:
- name: Download an artifacts from MinIO
uses: yakubique/[email protected]
with:
endpoint: http://ciserver.ci:9000
insecure: true
access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cipublish
source: "/${{ github.repository_id }}/${{ needs.build_images.outputs.build_tag }}/"
target: "."
recursive: true

- name: Assign a build tag
run: |
mkdir -p debian
mkdir -p buildroot
cp deploy/*-bootloader-*.img debian
cp deploy/*-bootloader-*.img buildroot
cp deploy/*-debian-*.img.* debian
cp deploy/*-buildroot-*.img.* buildroot

- name: Upload Debian to S3
uses: shallwefootball/[email protected]
with:
aws_key_id: ${{ secrets.IMAGES_S3_ACCESS }}
aws_secret_access_key: ${{ secrets.IMAGES_S3_SECRET }}
aws_bucket: ${{ secrets.IMAGES_S3_BUCKET }}
endpoint: ${{ secrets.IMAGES_S3_HOST }}
source_dir: debian
destination_dir: RZ/Debian/${{ needs.build_images.outputs.build_tag }}

- name: Upload Debian to S3
uses: shallwefootball/[email protected]
with:
aws_key_id: ${{ secrets.IMAGES_S3_ACCESS }}
aws_secret_access_key: ${{ secrets.IMAGES_S3_SECRET }}
aws_bucket: ${{ secrets.IMAGES_S3_BUCKET }}
endpoint: ${{ secrets.IMAGES_S3_HOST }}
source_dir: debian
destination_dir: RZ/Buildroot/${{ needs.build_images.outputs.build_tag }}
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
build/
build/tmp
build/output
build/cache
build/toolchain
images/
*.swp
.vscode-ctags
ccache/
.vscode
ccache/
16 changes: 16 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[submodule "build/buildroot"]
path = build/buildroot
url = https://github.com/buildroot/buildroot.git
[submodule "build/linux-stable"]
path = build/linux-stable
url = https://github.com/SolidRun/linux-stable.git
shallow = true
[submodule "build/rswlan"]
path = build/rswlan
url = https://github.com/SolidRun/rswlan.git
[submodule "build/rzg_trusted-firmware-a"]
path = build/rzg_trusted-firmware-a
url = https://github.com/SolidRun/arm-trusted-firmware
[submodule "build/u-boot"]
path = build/u-boot
url = https://github.com/SolidRun/u-boot.git
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 SolidRun Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading