From cba0fc53bcddc5019268bcab8064e70cdcd4bc73 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 18 Jan 2025 12:05:41 +0300 Subject: [PATCH 1/5] ci: add new release workflow ci: update release workflow ci: update release workflow ci: update release workflow --- .fluentci/plugin/src/lib.rs | 61 ++++++++++++++++++++++++++++++++++- .github/workflows/release.yml | 35 ++++++++++++++++++++ Dockerfile | 2 -- 3 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.fluentci/plugin/src/lib.rs b/.fluentci/plugin/src/lib.rs index 9d7a5c0221..457082a3f6 100644 --- a/.fluentci/plugin/src/lib.rs +++ b/.fluentci/plugin/src/lib.rs @@ -6,6 +6,65 @@ mod helpers; use helpers::detect_system; +#[plugin_fn] +pub fn build(_arg: String) -> FnResult { + let stdout = dag() + .pipeline("build")? + .pkgx()? + .with_workdir("./webui/rockbox")? + .with_exec(vec!["sudo", "apt-get", "update"])? + .with_exec(vec![ + "sudo", + "apt-get install", + "-y", + "build-essential", + "libusb-dev", + "libsdl2-dev", + "libfreetype6-dev", + "libunwind-dev", + "curl", + "wget", + "zip", + "unzip", + "protobuf-compiler", + "cmake", + ])? + .with_exec(vec![ + "pkgm", + "install", + "zig@0.13.0", + "buf", + "deno", + "bun", + "node@18", + ])? + .with_exec(vec!["deno install"])? + .with_exec(vec!["deno", "run", "build"])? + .stdout()?; + + dag() + .pipeline("mkdir")? + .pkgx()? + .with_exec(vec!["mkdir", "-p", "build"])? + .stdout()?; + + dag() + .pipeline("build") + .pkgx()? + .with_workdir("build")? + .with_exec(vec![ + "../tools/configure", + "--target=sdlapp", + "--type=N", + "--lcdwidth=320", + "--lcdheight=240", + "--prefix=/usr/local", + ])? + .with_exec(vec!["make", "zig", "-j$(nproc)"])? + .stdout()?; + Ok(stdout) +} + #[plugin_fn] pub fn release(_args: String) -> FnResult { let tag = dag().get_env("TAG")?; @@ -129,7 +188,7 @@ pub fn release(_args: String) -> FnResult { } #[plugin_fn] -pub fn build(args: String) -> FnResult { +pub fn build_docker(args: String) -> FnResult { let version = dag() .get_env("BUILDX_VERSION") .unwrap_or("v0.17.1-desktop.1".into()); diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..79b00fd704 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: release +on: + push: + branches: + - master + tags: + - "*" + workflow_dispatch: + inputs: + tag: + description: "The existing tag to publish" + type: "string" + required: true + pull_request: + +jobs: + publish: + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-22.04-arm] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build and upload release + uses: fluentci-io/setup-fluentci@v5 + with: + wasm: true + plugin: . + args: | + build + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ inputs.tag || github.ref_name }} diff --git a/Dockerfile b/Dockerfile index f3720948b9..e17518b13c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,8 +50,6 @@ ENV PATH=/root/.local/bin:${PATH} WORKDIR /app -RUN [ -n "$TAG" ] && fluentci run --wasm . release ; exit 0 - FROM debian:bookworm RUN apt-get update && apt-get install -y \ From a35312649b53eddf4498d604d63435b9e7bdc191 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 18 Jan 2025 12:30:55 +0300 Subject: [PATCH 2/5] ci: update release workflow --- .fluentci/plugin/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.fluentci/plugin/src/lib.rs b/.fluentci/plugin/src/lib.rs index 457082a3f6..3acd2349d2 100644 --- a/.fluentci/plugin/src/lib.rs +++ b/.fluentci/plugin/src/lib.rs @@ -49,7 +49,7 @@ pub fn build(_arg: String) -> FnResult { .stdout()?; dag() - .pipeline("build") + .pipeline("build")? .pkgx()? .with_workdir("build")? .with_exec(vec![ @@ -62,6 +62,7 @@ pub fn build(_arg: String) -> FnResult { ])? .with_exec(vec!["make", "zig", "-j$(nproc)"])? .stdout()?; + Ok(stdout) } From b327b4c1515b42ae0012a246d529aa49fdae8c6d Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 18 Jan 2025 12:35:42 +0300 Subject: [PATCH 3/5] ci: enable git submodules --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79b00fd704..1936725ada 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + submodules: true - name: Build and upload release uses: fluentci-io/setup-fluentci@v5 with: From d87a03dabc1162254cb6ac4659adc70861bc7930 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 18 Jan 2025 12:58:09 +0300 Subject: [PATCH 4/5] ci: install protoc from sources ci: install protoc from sources ci: install protoc from sources ci: install protoc from sources --- .fluentci/plugin/src/lib.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.fluentci/plugin/src/lib.rs b/.fluentci/plugin/src/lib.rs index 3acd2349d2..7ce54a73ec 100644 --- a/.fluentci/plugin/src/lib.rs +++ b/.fluentci/plugin/src/lib.rs @@ -26,7 +26,6 @@ pub fn build(_arg: String) -> FnResult { "wget", "zip", "unzip", - "protobuf-compiler", "cmake", ])? .with_exec(vec![ @@ -42,6 +41,25 @@ pub fn build(_arg: String) -> FnResult { .with_exec(vec!["deno", "run", "build"])? .stdout()?; + // download & install protoc + dag() + .pipeline("protoc")? + .pkgx()? + .with_exec(vec![ + "git", + "clone", + "https://github.com/protocolbuffers/protobuf", + ])? + .with_exec(vec![ + "cd protobuf &&", + "git checkout v29.2 &&", + "git submodule update --init --recursive &&", + "mkdir build &&", + "cd build &&", + "cmake .. && sudo make install -j$(nproc)", + ])? + .stdout()?; + dag() .pipeline("mkdir")? .pkgx()? From bbbaeaa6e969c68fb074ca84d108b746956173a7 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 18 Jan 2025 13:23:45 +0300 Subject: [PATCH 5/5] ci: run release workflow on release --- .fluentci/plugin/src/lib.rs | 2 +- .github/workflows/release.yml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.fluentci/plugin/src/lib.rs b/.fluentci/plugin/src/lib.rs index 7ce54a73ec..3650ac9584 100644 --- a/.fluentci/plugin/src/lib.rs +++ b/.fluentci/plugin/src/lib.rs @@ -78,7 +78,7 @@ pub fn build(_arg: String) -> FnResult { "--lcdheight=240", "--prefix=/usr/local", ])? - .with_exec(vec!["make", "zig", "-j$(nproc)"])? + .with_exec(vec!["sudo", "make", "ziginstall", "-j$(nproc)"])? .stdout()?; Ok(stdout) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1936725ada..fa4bc8d3e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,6 @@ name: release on: push: - branches: - - master tags: - "*" workflow_dispatch: @@ -11,7 +9,6 @@ on: description: "The existing tag to publish" type: "string" required: true - pull_request: jobs: publish: @@ -30,6 +27,7 @@ jobs: plugin: . args: | build + release env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAG: ${{ inputs.tag || github.ref_name }}