Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all logic of build.yml to called workflows. #202

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
421 changes: 26 additions & 395 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

114 changes: 114 additions & 0 deletions .github/workflows/cli-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build CLI binaries

on:
workflow_call:

env:
CARGO_TERM_COLOR: always
SOURCE_PATH: "./src"

jobs:
cli-build:
strategy:
fail-fast: false
matrix:
target: [
x86_64-unknown-linux-gnu,
aarch64-unknown-linux-musl,
i686-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
arm-unknown-linux-gnueabi,
arm-unknown-linux-gnueabihf,
armv7-unknown-linux-gnueabihf,
riscv64gc-unknown-linux-gnu,
x86_64-unknown-linux-musl,

x86_64-pc-windows-msvc,
i686-pc-windows-msvc,
aarch64-pc-windows-msvc,

x86_64-apple-darwin,
aarch64-apple-darwin,

x86_64-unknown-netbsd,
]
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: i686-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: arm-unknown-linux-gnueabi
os: ubuntu-latest
cross: true
- target: arm-unknown-linux-gnueabihf
os: ubuntu-latest
cross: true
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
cross: true
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: true

- target: x86_64-pc-windows-msvc
os: windows-2022
cross: false
- target: i686-pc-windows-msvc
os: windows-2022
cross: false
- target: aarch64-pc-windows-msvc
os: windows-2022
cross: false

- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false

- target: x86_64-unknown-netbsd
os: ubuntu-latest
cross: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
cache-on-failure: true
- uses: actions-rs/cargo@v1
name: Compile
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --locked --bin cube_shuffle-cli --target ${{ matrix.target }} --target-dir "${{ github.workspace }}/cli_build"
- name: Rename executable
run: >
mv
"${{ github.workspace }}/cli_build/${{ matrix.target }}/release/cube_shuffle-cli${{runner.os == 'Windows' && '.exe' || ''}}"
"cube_shuffle-cli_${{ matrix.target }}${{runner.os == 'Windows' && '.exe' || ''}}"
- uses: actions/upload-artifact@v3
name: Upload executable
with:
name: CubeShuffle-cli_${{ matrix.target }}
if-no-files-found: error
path: "cube_shuffle-cli_${{ matrix.target }}${{runner.os == 'Windows' && '.exe' || ''}}"
83 changes: 83 additions & 0 deletions .github/workflows/cordova-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Builds the Cordova project from pre-built WASM

on:
workflow_call:

jobs:
cordova-build:
container:
image: cimg/android:2022.09.2-node
options: --user root
runs-on: ubuntu-latest
steps:
- name: Install cordova
run: npm install -g [email protected]
- name: Install Android build tools
run: sdkmanager "build-tools;32.0.0"
- uses: actions/checkout@v3
with:
submodules: 'recursive'
path: ${{ env.SOURCE_PATH }}
- name: Download compiled WASM
uses: actions/download-artifact@v3
with:
name: CubeShuffle-wasm
path: "${{ env.SOURCE_PATH }}/cube_shuffle-cordova/www"
- name: Build Android
working-directory: "${{ env.SOURCE_PATH }}/cube_shuffle-cordova"
run: |
cordova platform add android --no-telemetry --verbose
cordova build android --device --release --no-telemetry --verbose
- name: Extract build output
run: mv "${{ env.SOURCE_PATH }}/cube_shuffle-cordova/platforms/android/app/build/outputs/bundle/release/app-release.aab" "./CubeShuffle_Android.aab"
- uses: actions/upload-artifact@v3
with:
name: CubeShuffle-Cordova-Android-Bundle
if-no-files-found: error
path: "./CubeShuffle_Android.aab"

apk-generate:
container:
image: openjdk:19-jdk-slim-bullseye
runs-on: ubuntu-latest
needs: [ cordova-build ]
steps:
- name: Install dependencies
run: |
apt-get -y update
apt-get -y install wget unzip git
- uses: actions/checkout@v3
with:
submodules: false
path: ${{ env.SOURCE_PATH }}
- name: Download bundletool
run: wget -O bundletool.jar https://github.com/google/bundletool/releases/download/1.9.0/bundletool-all-1.9.0.jar
- name: Download AAB
uses: actions/download-artifact@v3
with:
name: CubeShuffle-Cordova-Android-Bundle
- name: Build signed APKS
if: startsWith(github.ref, 'refs/tags/v')
run: >
java -jar "./bundletool.jar" build-apks
--mode="universal"
--ks="${{ env.SOURCE_PATH }}/cubeshuffle.keystore"
--ks-pass="pass:${{ secrets.KEYSTORE_PASSWORD }}"
--ks-key-alias="cush"
--bundle="./CubeShuffle_Android.aab"
--output="./CubeShuffle_Android.apks"
- name: Build unsigned APKS
if: startsWith(github.ref, 'refs/tags/v') != true
run: >
java -jar "./bundletool.jar" build-apks
--mode="universal"
--bundle="./CubeShuffle_Android.aab"
--output="./CubeShuffle_Android.apks"
- name: Extract APK
run: unzip -p "./CubeShuffle_Android.apks" "universal.apk" > "./CubeShuffle_Android.apk"
- uses: actions/upload-artifact@v3
with:
name: CubeShuffle-Cordova-Android-Universal
if-no-files-found: error
path: |
./CubeShuffle_Android.apk
70 changes: 70 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Publish a new version

on:
workflow_dispatch:

jobs:
build:
uses: './.github/workflows/build.yml'

publish:
needs: [ build ]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
- name: List artifacts
run: ls -R
- name: Install jq
run: |
sudo apt-get -y update
sudo apt-get -y install jq
- name: Make update json
run: |
jq -n \
--arg version "${GITHUB_REF##*/v}" \
--arg tag_version "${GITHUB_REF##*/}" \
--arg now `date --iso-8601=ns` \
'{
"name": $version,
"notes": "All releases at https://github.com/philipborg/CubeShuffle/releases",
"pub_date": $now,
"platforms": {
"darwin-aarch64": {
"signature": "",
"url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.app.tar.gz")
},
"darwin-x86_64": {
"signature": "",
"url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.app.tar.gz")
},
"linux-x86_64": {
"signature": "",
"url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.AppImage.tar.gz")
},
"windows-x86_64": {
"signature": "",
"url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.msi.zip")
}
}
}' \
> "update_info.json"
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
draft: true
fail_on_unmatched_files: true
prerelease: true
files: |
CubeShuffle-Cordova-Android-Bundle/CubeShuffle_Android.aab
CubeShuffle-Cordova-Android-Universal/CubeShuffle_Android.apk
CubeShuffle-Tauri_Linux_X64.AppImage/CubeShuffle-GUI.AppImage
CubeShuffle-Tauri_Linux_X64.AppImage/CubeShuffle-GUI.AppImage.tar.gz
CubeShuffle-Tauri_Linux_X64.deb/CubeShuffle-GUI.deb
CubeShuffle-Tauri_Windows_X64.msi/CubeShuffle-GUI.msi
CubeShuffle-Tauri_Windows_X64.msi/CubeShuffle-GUI.msi.zip
CubeShuffle-Tauri_macOS_Universal.dmg/CubeShuffle-GUI.dmg
CubeShuffle-Tauri_macOS_Universal.app/CubeShuffle-GUI.app.tar.gz
CubeShuffle-cli_*/*
update_info.json
80 changes: 80 additions & 0 deletions .github/workflows/tauri-linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Tauri Linux Build

on:
workflow_call:
inputs:
TRUNK_VERSION:
required: true
type: string
TAURI_CLI_VERSION:
required: true
type: string

env:
CARGO_TERM_COLOR: always
SOURCE_PATH: "./src"

jobs:
build-tauri:
name: Builds Tauri for Linux
runs-on: ubuntu-latest
steps:
- name: Install webkit/GTK dependencies (Linux)
run: |
sudo apt-get -y update
sudo apt-get -y install libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- uses: actions/checkout@v3
with:
submodules: 'recursive'
path: ${{ env.SOURCE_PATH }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
components: rustfmt, clippy
override: true
- uses: Swatinem/rust-cache@v1
with:
working-directory: ${{ env.SOURCE_PATH }}
cache-on-failure: true
key: Trunk_${{ inputs.TRUNK_VERSION }}-TauriCLI_${{ inputs.TAURI_CLI_VERSION }}
- name: Install Trunk
run: cargo install --locked trunk --version ${{ inputs.TRUNK_VERSION }}
- name: Install Tauri
run: cargo install tauri-cli --locked --version ${{ inputs.TAURI_CLI_VERSION }}

- name: Tauri Build
run: cargo tauri build || true
working-directory: "${{ env.SOURCE_PATH }}/src-tauri"

- uses: actions/upload-artifact@v3
name: Tauri Linux executable
with:
if-no-files-found: error
name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}_EXECUTABLE
path: "${{ env.SOURCE_PATH }}/target/release/cube-shuffle"
- name: Exfiltrate deb
run: mv "${{ env.SOURCE_PATH }}/target/release/bundle/deb/cube-shuffle"*".deb" "CubeShuffle-GUI.deb"
- uses: actions/upload-artifact@v3
name: Tauri Linux deb
with:
if-no-files-found: error
name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.deb
path: "CubeShuffle-GUI.deb"
- name: Exfiltrate AppImage
run: |
mv "${{ env.SOURCE_PATH }}/target/release/bundle/appimage/cube-shuffle"*".AppImage" "CubeShuffle-GUI.AppImage"
mv "${{ env.SOURCE_PATH }}/target/release/bundle/appimage/cube-shuffle"*".AppImage.tar.gz" "CubeShuffle-GUI.AppImage.tar.gz"
- uses: actions/upload-artifact@v3
name: Tauri Linux AppImage
with:
if-no-files-found: error
name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.AppImage
path: "CubeShuffle-GUI.AppImage*"
Loading