Skip to content

Commit 0a66fbe

Browse files
committed
Add builds
1 parent ce4c44a commit 0a66fbe

12 files changed

+447
-0
lines changed

.github/actions/build/action.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build
2+
description: Build
3+
4+
inputs:
5+
arch:
6+
required: true
7+
default: ''
8+
description: Rust target platform.
9+
extra_flags:
10+
required: false
11+
default: ''
12+
description: Rust extra flags.
13+
env_flags:
14+
required: false
15+
default: ''
16+
description: RUSTFLAGS env var.
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Rust Install Nightly
22+
shell: sh
23+
run: |
24+
rustup install nightly
25+
rustup default nightly
26+
rustup toolchain install nightly
27+
rustup override set nightly
28+
rustup component add rust-src --toolchain nightly
29+
rustup target add ${{ inputs.arch }} --toolchain nightly
30+
- name: Build
31+
shell: sh
32+
run: |
33+
cargo +nightly build --target=${{ inputs.arch }} --release ${{ inputs.extra_flags}}
34+
env:
35+
RUSTFLAGS: ${{ inputs.env_flags }}
36+
EMCC_CFLAGS: "-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry -gsource-map -s STANDALONE_WASM"
37+
- name: Copy to release
38+
shell: sh
39+
run: |
40+
mkdir -p target/release
41+
rm -rf target/release
42+
cp -rf target/${{ inputs.arch }}/release target/release
43+
- name: Build Macos Universal
44+
shell: sh
45+
# we already built for x86_64-apple-darwin for mac, now build arm64
46+
if: ${{ inputs.arch == 'x86_64-apple-darwin'}}
47+
run: |
48+
mkdir -p target/release
49+
rustup target add aarch64-apple-darwin
50+
cargo build --target=aarch64-apple-darwin --release --features="${{ inputs.features }}" --no-default-features
51+
lipo -create -output target/release/librust_syntax.dylib target/aarch64-apple-darwin/release/librust_syntax.dylib target/x86_64-apple-darwin/release/librust_syntax.dylib

.github/workflows/android_builds.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 🤖 Android Builds
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
android:
7+
runs-on: "ubuntu-20.04"
8+
name: ${{ matrix.arch }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
arch: ["x86_64-linux-android", "aarch64-linux-android", "i686-linux-android", "armv7-linux-androideabi"]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Java 11
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: temurin
20+
java-version: 11
21+
22+
- uses: nttld/setup-ndk@v1
23+
with:
24+
ndk-version: r23c
25+
- name: Install Cargo NDK
26+
shell: sh
27+
run: |
28+
rustup toolchain install nightly
29+
rustup override set nightly
30+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
31+
#cargo install cargo-ndk
32+
- name: Build share libraries
33+
shell: sh
34+
run: |
35+
rustup target add armv7-linux-androideabi
36+
rustup target add aarch64-linux-android
37+
#cargo +nightly ndk -t armeabi-v7a -t arm64-v8a -o ./jniLibs build --release
38+
- name: Build
39+
uses: ./.github/actions/build
40+
with:
41+
arch: ${{ matrix.arch }}
42+
- name: Copy to bin
43+
shell: sh
44+
run: |
45+
mv target/release/librust_syntax.so demo/addons/rust-syntax/bin/librust_syntax.android.so
46+
- name: Upload
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: rust-syntax-${{ matrix.arch}}
50+
path: |
51+
demo/**/*.so
52+
if-no-files-found: error

.github/workflows/godot_builds.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Godot Builds
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
godot:
7+
runs-on: "ubuntu-latest"
8+
name: Godot Files
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Upload
13+
uses: actions/upload-artifact@v4
14+
with:
15+
name: rust-syntax-godot
16+
path: |
17+
demo
18+
if-no-files-found: error

.github/workflows/ios_builds.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 🍏 iOS Builds
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
ios:
7+
runs-on: "macos-latest"
8+
name: ${{ matrix.arch }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
arch: ["aarch64-apple-ios"]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Build
17+
uses: ./.github/actions/build
18+
with:
19+
arch: ${{ matrix.arch }}
20+
- name: Copy to bin
21+
shell: sh
22+
run: |
23+
mv target/release/librust_syntax.dylib demo/addons/rust-syntax/bin/librust_syntax.ios.framework/librust_syntax.ios.dylib
24+
- name: iOS Sign
25+
shell: pwsh
26+
env:
27+
APPLE_CERT_BASE64: ${{ secrets.PROD_MACOS_CERTIFICATE }}
28+
APPLE_CERT_PASSWORD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
29+
APPLE_DEV_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
30+
APPLE_DEV_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
31+
APPLE_DEV_PASSWORD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
32+
APPLE_DEV_APP_ID: ${{ secrets.PROD_MACOS_APPLE_DEV_APP_ID }}
33+
run: |
34+
./scripts/ci-sign-macos.ps1 demo/addons/rust-syntax/bin/librust_syntax.ios.framework/librust_syntax.ios.dylib
35+
if: ${{ env.APPLE_DEV_ID }}
36+
37+
- name: Upload
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: rust-syntax-${{ matrix.arch}}
41+
path: |
42+
demo/**/*.dylib
43+
if-no-files-found: error

.github/workflows/linux_builds.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 🐧 Linux Builds
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
linux:
7+
runs-on: ubuntu-20.04
8+
name: ${{ matrix.arch }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
#arch: ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]
13+
arch: ["x86_64-unknown-linux-gnu"]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: "Install dependencies"
18+
shell: sh
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install libunwind-dev
22+
sudo apt-get install build-essential
23+
sudo apt-get install pkg-config
24+
sudo apt-get install libssl-dev
25+
sudo apt-get install zlib1g-dev
26+
- name: Build
27+
uses: ./.github/actions/build
28+
with:
29+
arch: ${{ matrix.arch }}
30+
- name: Copy to bin
31+
shell: sh
32+
run: |
33+
mv target/release/librust-syntax.so demo/addons/rust-syntax/bin/librust_syntax.linux.so
34+
- name: Upload
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: rust-syntax-${{ matrix.arch}}
38+
path: |
39+
demo/**/*.so
40+
if-no-files-found: error
41+

.github/workflows/macos_builds.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 🍎 macOS Builds
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
macos:
7+
runs-on: "macos-latest"
8+
name: ${{ matrix.arch }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
arch: ["x86_64-apple-darwin"]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Build
17+
uses: ./.github/actions/build
18+
with:
19+
arch: ${{ matrix.arch }}
20+
- name: Copy to bin
21+
shell: sh
22+
run: |
23+
mv target/release/librust_syntax.dylib demo/addons/rust-syntax/bin/librust_syntax.macos.framework/librust_syntax.macos.dylib
24+
- name: Mac Sign
25+
uses: ughuuu/godot-cpp-template/.github/actions/sign@add-more-stuff/options-to-build
26+
with:
27+
FRAMEWORK_PATH: demo/addons/rust-syntax/bin/librust_syntax.macos.framework
28+
SIGN_FLAGS: "--deep"
29+
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
30+
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
31+
APPLE_DEV_PASSWORD: ${{ secrets.APPLE_DEV_PASSWORD }}
32+
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
33+
APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }}
34+
APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }}
35+
36+
- name: Upload
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: rust-syntax-${{ matrix.arch}}
40+
path: |
41+
demo/**/*.dylib
42+
demo/**/CodeResources
43+
if-no-files-found: error

.github/workflows/release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-20.04
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Download artifacts
13+
uses: actions/download-artifact@v4
14+
with:
15+
pattern: rust-syntax-*
16+
merge-multiple: true
17+
path: rust-syntax
18+
name: rust-syntax
19+
- name: Delete draft release(s)
20+
uses: hugo19941994/[email protected]
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Archive
24+
shell: sh
25+
run: |
26+
ls
27+
zip -r "rust-syntax.zip" rust-syntax
28+
- name: Release
29+
uses: softprops/action-gh-release@v1
30+
with:
31+
name: Rust Syntax Nightly
32+
files: |
33+
rust-syntax.zip
34+
generate_release_notes: true
35+
draft: true
36+
prerelease: true
37+
fail_on_unmatched_files: true

.github/workflows/runner.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: 🔗 Builds
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- "main"
8+
9+
jobs:
10+
static-checks:
11+
name: 📊 Static checks
12+
uses: ./.github/workflows/static_checks.yml
13+
14+
#android-build:
15+
# name: 🤖 Android
16+
# needs: static-checks
17+
# uses: ./.github/workflows/android_builds.yml
18+
19+
ios-build:
20+
name: 🍏 iOS
21+
needs: static-checks
22+
uses: ./.github/workflows/ios_builds.yml
23+
24+
linux-build:
25+
name: 🐧 Linux
26+
needs: static-checks
27+
uses: ./.github/workflows/linux_builds.yml
28+
29+
macos-build:
30+
name: 🍎 macOS
31+
needs: static-checks
32+
uses: ./.github/workflows/macos_builds.yml
33+
secrets: inherit
34+
35+
windows-build:
36+
name: 🏁 Windows
37+
needs: static-checks
38+
uses: ./.github/workflows/windows_builds.yml
39+
40+
godot-build:
41+
name: Godot
42+
uses: ./.github/workflows/godot_builds.yml
43+
44+
web-build:
45+
name: 🌐 Web Builds
46+
needs: static-checks
47+
uses: ./.github/workflows/web_builds.yml
48+
49+
merge:
50+
runs-on: ubuntu-latest
51+
name: Merge
52+
#needs: [android-build, ios-build, linux-build, macos-build, windows-build, godot-build, web-build]
53+
needs: [ios-build, linux-build, macos-build, windows-build, godot-build, web-build]
54+
steps:
55+
- uses: actions/upload-artifact/merge@v4
56+
with:
57+
name: rust-syntax
58+
pattern: rust-syntax-*
59+
60+
release:
61+
name: Create Release
62+
permissions:
63+
contents: write
64+
needs: [merge]
65+
uses: ./.github/workflows/release.yml

.github/workflows/static_checks.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 📊 Static Checks
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
static-checks:
7+
name: Code style
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Format
12+
shell: sh
13+
run: cargo fmt --all -- --config-path ./rustfmt.toml

0 commit comments

Comments
 (0)