Skip to content

Commit

Permalink
feat: add aarch64 builds for OSX + overhaul CI with caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen Nijhuis committed Apr 23, 2024
1 parent f1188ee commit 92b9e55
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 56 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
Expand All @@ -37,6 +37,11 @@ jobs:
with:
toolchain: stable

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
Expand All @@ -52,19 +57,16 @@ jobs:
copy "C:\Program Files\OpenSSL\bin\libcrypto-3-x64.dll" .\src-tauri
copy "C:\Program Files\OpenSSL\bin\libssl-3-x64.dll" .\src-tauri
- name: Build Vite + Tauri (MacOS + Linux)
if: matrix.platform != 'windows-latest'
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
- name: Set Windows Env Vars
run: |
npm run build
if [ "${{ matrix.platform }}" = "windows-latest" ]; then
echo "export OPENSSL_DIR='C:\Program Files\OpenSSL'" >> $GITHUB_ENV
echo "export SSL_CERT_FILE='C:\Program Files\OpenSSL\ca\cacert.pem'" >> $GITHUB_ENV
echo "export OPENSSL_NO_VENDOR=1" >> $GITHUB_ENV
fi
- name: Build Vite + Tauri (Windows)
if: matrix.platform == 'windows-latest'
- name: Build Vite + Tauri
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
OPENSSL_DIR: 'C:\Program Files\OpenSSL'
SSL_CERT_FILE: 'C:\Program Files\OpenSSL\ca\cacert.pem'
OPENSSL_NO_VENDOR: 1
run: |
npm run build
77 changes: 33 additions & 44 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,77 +14,65 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
settings:
- platform: "macos-latest"
args: "--target aarch64-apple-darwin"
- platform: "macos-latest"
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-latest"
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
runs-on: ${{ matrix.settings.platform }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"

- name: Install dependencies
run: npm install

- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
if: matrix.settings.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Install OpenSSL (Windows only)
if: matrix.platform == 'windows-latest'
if: matrix.settings.platform == 'windows-latest'
run: |
choco install openssl
mkdir -p "C:\Program Files\OpenSSL\ca"
curl -o "C:\Program Files\OpenSSL\ca\cacert.pem" https://curl.se/ca/cacert.pem
copy "C:\Program Files\OpenSSL\bin\libcrypto-3-x64.dll" .\src-tauri
copy "C:\Program Files\OpenSSL\bin\libssl-3-x64.dll" .\src-tauri
- name: Build Vite + Tauri (MacOS + Linux)
if: matrix.platform != 'windows-latest'
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
run: npm run build

- name: Build Vite + Tauri (Windows)
if: matrix.platform == 'windows-latest'
env:
OPENSSL_DIR: 'C:\Program Files\OpenSSL'
SSL_CERT_FILE: 'C:\Program Files\OpenSSL\ca\cacert.pem'
OPENSSL_NO_VENDOR: 1
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
run: npm run build
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: Create release (MacOS + Linux)
if: matrix.platform != 'windows-latest'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "v__VERSION__"
releaseBody: "See the assets to download and install this version."
releaseDraft: true
prerelease: false
tauriScript: ./node_modules/.bin/tauri
workspaces: "./src-tauri -> target"

- name: Install dependencies
run: npm install

- name: Set Windows Env Vars
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
echo "export OPENSSL_DIR='C:\Program Files\OpenSSL'" >> $GITHUB_ENV
echo "export SSL_CERT_FILE='C:\Program Files\OpenSSL\ca\cacert.pem'" >> $GITHUB_ENV
echo "export OPENSSL_NO_VENDOR=1" >> $GITHUB_ENV
fi
- name: Create release (Windows)
if: matrix.platform == 'windows-latest'
- name: Create release
uses: tauri-apps/tauri-action@v0
env:
OPENSSL_DIR: 'C:\Program Files\OpenSSL'
SSL_CERT_FILE: 'C:\Program Files\OpenSSL\ca\cacert.pem'
OPENSSL_NO_VENDOR: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
with:
Expand All @@ -94,3 +82,4 @@ jobs:
releaseDraft: true
prerelease: false
tauriScript: ./node_modules/.bin/tauri
args: ${{ matrix.settings.args }}
21 changes: 21 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tauri-build = { version = "1.4.0", features = [] }
[dependencies]
serde_json = "1.0.100"
serde = { version = "1.0.167", features = ["derive"] }
tauri = { version = "1.4.1", features = [ "macos-private-api", "api-all"] }
tauri = { version = "1.4.1", features = [ "updater", "macos-private-api", "api-all"] }
tokio = "1.29.1"
kube = { version = "0.87.2" }
k8s-openapi = { version = "0.20.0", features = ["v1_26"] }
Expand Down
5 changes: 5 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import CommandPaletteProvider from "./providers/CommandPaletteProvider";
import TabProvider from "./providers/TabProvider";
import DialogProvider from "./providers/DialogProvider";
import DialogHandler from "./components/DialogHandler.vue";
import { checkUpdate } from "@tauri-apps/api/updater";
checkUpdate().then((update) => {
console.log(update);
});
</script>

<template>
Expand Down

0 comments on commit 92b9e55

Please sign in to comment.