Merge pull request #176 from teaxyz/pnpm-cargo-cache

#172 ci cache implementation: pnpm store and cargo build target
This commit is contained in:
Neil 2023-01-25 17:41:52 +08:00 committed by GitHub
commit 7a578571e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 16 deletions

View file

@ -67,8 +67,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - 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 - name: build tauri for Linux
uses: docker://getneil/tea-builder:latest uses: ./devops/linux-builder
- uses: aws-actions/configure-aws-credentials@v1 - uses: aws-actions/configure-aws-credentials@v1
with: with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
@ -120,10 +127,24 @@ jobs:
- uses: teaxyz/setup@v0 - uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'darwin') if: startsWith(matrix.platform.name, 'darwin')
- name: cache gui build
# TODO: cache issue in our self-hosted macos runner ESPIPE: invalid seek, read
# but its ok to ignore, its still the fastest builder
# NOTE: enabling cache in the self hosted runner slows down the pipeline by 4m because post-cache builder error ^
if: startsWith(matrix.platform.name, 'linux') || matrix.platform.name == 'darwin+x86-64'
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 - name: build tauri for MacOS
if: startsWith(matrix.platform.name, 'darwin') if: startsWith(matrix.platform.name, 'darwin')
# FROM: https://tauri.app/v1/guides/distribution/sign-macos # FROM: https://tauri.app/v1/guides/distribution/sign-macos
env: env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }} ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }} APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
@ -134,9 +155,9 @@ jobs:
- name: build tauri for Linux - name: build tauri for Linux
if: startsWith(matrix.platform.name, 'linux') if: startsWith(matrix.platform.name, 'linux')
# TODO: https://tauri.app/v1/guides/distribution/sign-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 . - run: tar -czvf artifacts.tgz -C ./target/release/bundle .
- name: upload artifacts - name: upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View file

@ -36,6 +36,13 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
persist-credentials: false persist-credentials: false
- name: cache gui linux
uses: actions/cache@v3
with:
key: linux+x86-64-20-pnpm-cargo-main
path: |
./pnpm
./target
- name: build tauri for Linux - name: build tauri for Linux
if: startsWith(matrix.platform.name, 'linux') if: startsWith(matrix.platform.name, 'linux')
uses: docker://getneil/tea-builder:latest uses: docker://getneil/tea-builder:latest
@ -59,11 +66,22 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: teaxyz/setup@v0 - uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'darwin') if: startsWith(matrix.platform.name, 'darwin')
- name: cache gui build
# TODO: cache issue in our self-hosted macos runner ESPIPE: invalid seek, read
# but its ok to ignore, its still the fastest builder
# NOTE: enabling cache in the self hosted runner slows down the pipeline by 4m because post-cache builder error ^
if: startsWith(matrix.platform.name, 'linux') || matrix.platform.name == 'darwin+x86-64'
uses: actions/cache@v3
with:
key: ${{matrix.platform.name}}-pnpm-cargo-main
path: |
./pnpm
./target
- name: build tauri for MacOS - name: build tauri for MacOS
if: startsWith(matrix.platform.name, 'darwin') if: startsWith(matrix.platform.name, 'darwin')
run: tea -ES xc build run: tea -ES xc build
env: env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }} ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }} APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
@ -73,9 +91,9 @@ jobs:
- name: build tauri for Linux - name: build tauri for Linux
if: startsWith(matrix.platform.name, 'linux') if: startsWith(matrix.platform.name, 'linux')
# TODO: https://tauri.app/v1/guides/distribution/sign-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 . - run: tar -czvf artifacts.tgz -C ./target/release/bundle .
- name: upload artifacts - name: upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
node_modules node_modules
yarn-error.log yarn-error.log
.DS_Store .DS_Store
.pnpm-store .pnpm-store
target

View file

@ -0,0 +1,5 @@
FROM getneil/tea-builder:bincache
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -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 }}

View file

@ -0,0 +1,3 @@
#!/bin/sh -l
tea -SE xc setup
tea -SE xc build

View file

@ -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 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 --fix-missing patchelf pkg-config curl libatomic1 gcc-multilib libsoup-gnome2.4
RUN apt-get install -y libjavascriptcoregtk-4.0-dev wget RUN apt-get install -y libjavascriptcoregtk-4.0-dev wget
RUN curl https://tea.xyz -o ./tea.sh RUN curl https://tea.xyz -o ./tea.sh
RUN chmod +x tea.sh RUN chmod +x tea.sh
RUN ./tea.sh --yes 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`) # Code file to execute when the docker container starts up (`entrypoint.sh`)
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View file

@ -74,13 +74,6 @@
padding: 0vw 3.33vw; padding: 0vw 3.33vw;
} }
} }
header {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 40px;
}
slot { slot {
z-index: 1; z-index: 1;