From 32679959bab43c44700117bd06a6ea1ba502c09f Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 25 Jan 2023 14:58:19 +0800 Subject: [PATCH] #172 ci cache implementation: pnpm store and cargo build target --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- devops/linux-builder/Dockerfile | 5 +++++ devops/linux-builder/action.yml | 18 ++++++++++++++++++ devops/linux-builder/entrypoint.sh | 3 +++ devops/ubuntu/Dockerfile | 14 ++++++++++++-- modules/gui/src/routes/+layout.svelte | 7 ------- 6 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 devops/linux-builder/Dockerfile create mode 100644 devops/linux-builder/action.yml create mode 100755 devops/linux-builder/entrypoint.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 601c543..3d51a0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,8 +67,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: cache gui linux + uses: actions/cache@v3 + with: + key: linux+x86-64-20-pnpm-cargo + path: | + ./pnpm + ./target - name: build tauri for Linux - uses: docker://getneil/tea-builder:latest + uses: ./devops/linux-builder - uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -120,6 +127,15 @@ jobs: - uses: teaxyz/setup@v0 if: startsWith(matrix.platform.name, 'darwin') + - name: cache gui build + uses: actions/cache@v3 + with: + key: ${{matrix.platform.name}}-pnpm-cargo + path: | + ./pnpm + ./target + # - name: build tauri for Linux + # uses: ./devops/linux-build - name: build tauri for MacOS if: startsWith(matrix.platform.name, 'darwin') # FROM: https://tauri.app/v1/guides/distribution/sign-macos @@ -134,7 +150,7 @@ jobs: - name: build tauri for Linux if: startsWith(matrix.platform.name, 'linux') # TODO: https://tauri.app/v1/guides/distribution/sign-linux - uses: docker://getneil/tea-builder:latest + uses: ./devops/linux-builder - run: tar -czvf artifacts.tgz -C ./modules/gui/src-tauri/target/release/bundle . diff --git a/devops/linux-builder/Dockerfile b/devops/linux-builder/Dockerfile new file mode 100644 index 0000000..f1be13e --- /dev/null +++ b/devops/linux-builder/Dockerfile @@ -0,0 +1,5 @@ +FROM getneil/tea-builder:bincache + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/devops/linux-builder/action.yml b/devops/linux-builder/action.yml new file mode 100644 index 0000000..e1c90cb --- /dev/null +++ b/devops/linux-builder/action.yml @@ -0,0 +1,18 @@ +name: 'build-gui-linux' +description: 'Tea GUI builder for linux' +# TODO: cache +# inputs: +# who-to-greet: # id of input +# description: 'Who to greet' +# required: true +# default: 'World' +# outputs: +# time: # id of output +# description: 'The time we greeted you' +runs: + using: 'docker' + image: 'Dockerfile' + env: + CARGO_TARGET_DIR: /github/workspace/target + args: + - ${{ inputs.who-to-greet }} \ No newline at end of file diff --git a/devops/linux-builder/entrypoint.sh b/devops/linux-builder/entrypoint.sh new file mode 100755 index 0000000..2af50bd --- /dev/null +++ b/devops/linux-builder/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh -l +tea -SE xc setup +tea -SE xc build \ No newline at end of file diff --git a/devops/ubuntu/Dockerfile b/devops/ubuntu/Dockerfile index 27822a2..6b6d640 100644 --- a/devops/ubuntu/Dockerfile +++ b/devops/ubuntu/Dockerfile @@ -7,11 +7,21 @@ RUN apt-get install -y libgtk-3-dev webkit2gtk-4.0 RUN apt-get install -y --fix-missing libappindicator3-dev librsvg2-dev RUN apt-get install -y --fix-missing patchelf pkg-config curl libatomic1 gcc-multilib libsoup-gnome2.4 RUN apt-get install -y libjavascriptcoregtk-4.0-dev wget + RUN curl https://tea.xyz -o ./tea.sh RUN chmod +x tea.sh RUN ./tea.sh --yes -# Copies your code file from your action repository to the filesystem path `/` of the container -COPY entrypoint.sh /entrypoint.sh + +RUN mkdir -p /tmp/app/.git +COPY README.md /tmp/app/README.md +COPY package.json /tmp/app/package.json + +RUN tea +nodejs.org +RUN tea +pnpm.io +RUN tea +rust-lang.org +RUN tea +rust-lang.org/cargo +RUN tea +xcfile.dev # Code file to execute when the docker container starts up (`entrypoint.sh`) +COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/modules/gui/src/routes/+layout.svelte b/modules/gui/src/routes/+layout.svelte index 82fd45b..1da402c 100644 --- a/modules/gui/src/routes/+layout.svelte +++ b/modules/gui/src/routes/+layout.svelte @@ -74,13 +74,6 @@ padding: 0vw 3.33vw; } } - header { - position: absolute; - top: 0px; - left: 0px; - width: 100%; - height: 40px; - } slot { z-index: 1;