🐛 Restore rust cache

This commit is contained in:
Tw93
2023-07-20 19:04:35 +08:00
parent 7100f0636f
commit 4052fd164c
2 changed files with 162 additions and 121 deletions

View File

@@ -8,9 +8,9 @@ on:
default: "macos-latest" default: "macos-latest"
type: choice type: choice
options: options:
- "windows-latest" - "windows-latest"
- "macos-latest" - "macos-latest"
- "ubuntu-20.04" - "ubuntu-20.04"
url: url:
description: "[URL]" description: "[URL]"
required: true required: true
@@ -44,9 +44,9 @@ on:
default: "deb" default: "deb"
type: choice type: choice
options: options:
- "deb" - "deb"
- "appimage" - "appimage"
- "all" - "all"
jobs: jobs:
@@ -57,71 +57,91 @@ jobs:
fail-fast: false fail-fast: false
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: install node - name: install node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18
- name: Install Rust for ubuntu-20.04 - name: Install Rust for ubuntu-20.04
if: inputs.platform == 'ubuntu-20.04' if: inputs.platform == 'ubuntu-20.04'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
target: x86_64-unknown-linux-musl target: x86_64-unknown-linux-musl
- name: Install Rust for windows-latest - name: Install Rust for windows-latest
if: inputs.platform == 'windows-latest' if: inputs.platform == 'windows-latest'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable-x86_64-msvc toolchain: stable-x86_64-msvc
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
- name: Install Rust for macos-latest - name: Install Rust for macos-latest
if: inputs.platform == 'macos-latest' if: inputs.platform == 'macos-latest'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
target: x86_64-apple-darwin target: x86_64-apple-darwin
- name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
if: inputs.platform == 'ubuntu-20.04' if: inputs.platform == 'ubuntu-20.04'
uses: awalsh128/cache-apt-pkgs-action@latest uses: awalsh128/cache-apt-pkgs-action@latest
with: with:
packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
version: 1.1 version: 1.1
- name: install pake-cli local - name: install pake-cli local
shell: bash shell: bash
run: | run: |
echo "install pake on local" echo "install pake on local"
npm install pake-cli npm install pake-cli
- name: rust cache - name: rust cache restore
uses: Swatinem/rust-cache@v2 uses: actions/cache/restore@v3
id: cache_store
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
node_modules/pake-cli/src-tauri/target/
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
- name: build with pake-cli - name: build with pake-cli
shell: pwsh shell: pwsh
run: | run: |
pwsh ./script/build_with_pake_cli.ps1 pwsh ./script/build_with_pake_cli.ps1
env: env:
URL: ${{ inputs.url }} URL: ${{ inputs.url }}
NAME: ${{ inputs.name }} NAME: ${{ inputs.name }}
ICON: ${{ inputs.icon }} ICON: ${{ inputs.icon }}
HEIGHT: ${{ inputs.height }} HEIGHT: ${{ inputs.height }}
WIDTH: ${{ inputs.width }} WIDTH: ${{ inputs.width }}
TRANSPARENT: ${{ inputs.transparent }} TRANSPARENT: ${{ inputs.transparent }}
FULLSCREEN: ${{ inputs.fullscreen }} FULLSCREEN: ${{ inputs.fullscreen }}
RESIZE: ${{ inputs.resize }} RESIZE: ${{ inputs.resize }}
MULTI_ARCH: ${{ inputs.multi_arch }} MULTI_ARCH: ${{ inputs.multi_arch }}
TARGETS: ${{ inputs.targets }} TARGETS: ${{ inputs.targets }}
- name: Upload archive - name: Upload archive
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: output-${{ inputs.platform }}.zip name: output-${{ inputs.platform }}.zip
path: node_modules/pake-cli/output/* path: node_modules/pake-cli/output/*
retention-days: 3 retention-days: 3
- name: rust cache store
uses: actions/cache/save@v3
if: steps.cache_store.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
node_modules/pake-cli/src-tauri/target/
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}

View File

@@ -21,70 +21,91 @@ jobs:
matrix: matrix:
build: [linux, windows, macos] build: [linux, windows, macos]
include: include:
- build: linux - build: linux
os: ubuntu-20.04 os: ubuntu-20.04
rust: stable rust: stable
target: x86_64-unknown-linux-musl target: x86_64-unknown-linux-musl
# archive-name: target-linux.tar.gz # archive-name: target-linux.tar.gz
- build: windows - build: windows
os: windows-latest os: windows-latest
rust: stable-x86_64-msvc rust: stable-x86_64-msvc
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
# archive-name: target-windows.tar.gz # archive-name: target-windows.tar.gz
- build: macos - build: macos
os: macos-latest os: macos-latest
rust: stable rust: stable
target: x86_64-apple-darwin target: x86_64-apple-darwin
# archive-name: target-macos.tar.gz # archive-name: target-macos.tar.gz
fail-fast: false fail-fast: false
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: install node - name: install node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }} target: ${{ matrix.target }}
- name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-20.04' if: matrix.os == 'ubuntu-20.04'
uses: awalsh128/cache-apt-pkgs-action@latest uses: awalsh128/cache-apt-pkgs-action@latest
with: with:
packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
version: 1.1 version: 1.1
- name: rust cache - name: rust cache restore
uses: Swatinem/rust-cache@v2 uses: actions/cache/restore@v3
id: cache_store
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: build for Ubuntu - name: build for Ubuntu
if: matrix.os == 'ubuntu-20.04' if: matrix.os == 'ubuntu-20.04'
run: npm run build:all-unix run: npm run build:all-unix
- name: build for MacOS - name: build for MacOS
if: matrix.os == 'macos-latest' if: matrix.os == 'macos-latest'
run: | run: |
rustup target add aarch64-apple-darwin rustup target add aarch64-apple-darwin
npm run build:all-unix npm run build:all-unix
- name: build for windows - name: build for windows
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
shell: pwsh shell: pwsh
run: | run: |
npm run build:all-windows npm run build:all-windows
- name: Upload files - name: Upload files
# arg info: https://github.com/ncipollo/release-action#release-action # arg info: https://github.com/ncipollo/release-action#release-action
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
allowUpdates: true allowUpdates: true
prerelease: ${{ inputs.is_pre_release }} prerelease: ${{ inputs.is_pre_release }}
artifacts: "output/*/*.*" artifacts: "output/*/*.*"
tag: ${{ inputs.version }} tag: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: rust cache store
uses: actions/cache/save@v3
if: steps.cache_store.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}