Skip to content

Commit

Permalink
Update Cargo Build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Hangman committed Nov 21, 2024
1 parent e18d851 commit 37fa52f
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 114 deletions.
229 changes: 116 additions & 113 deletions .github/workflows/build_natives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,128 +17,131 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust library (Linux)
run: |
cd decoders_rs
cargo build --release
cd ..
- name: Copy Linux binary
run: mv -f decoders_rs/target/release/libdecoders_rs64.so core/src/main/resources/libdecoders_rs64.so

- name: Commit native library
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: github-actions[bot]
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
git add core/src/main/resources/
git diff-index --quiet HEAD || git commit -m "Update Linux natives" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.TF_WORKFLOW_TOKEN }}
branch: ${{ github.ref }}
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust library (Linux)
run: |
cd decoders_rs
cargo build --release
cd ..
- name: Copy Linux binary
run: mv -f decoders_rs/target/release/libdecoders_rs64.so core/src/main/resources/libdecoders_rs64.so

- name: Commit native library
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: github-actions[bot]
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
git add core/src/main/resources/
git diff-index --quiet HEAD || git commit -m "Update Linux natives" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

build-windows:
needs: build-linux
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust library (Windows)
run: |
cd decoders_rs
cargo build --release
cd ..
- name: Copy Windows binary
run: mv -Force decoders_rs/target/release/decoders_rs64.dll core/src/main/resources/decoders_rs64.dll

- name: Commit native library
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "GIT_USER_NAME: $GIT_USER_NAME"
echo "GIT_USER_EMAIL: $GIT_USER_EMAIL"
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git pull origin
git add core/src/main/resources/
git diff-index --quiet HEAD || git commit -m "Update Windows natives" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.TF_WORKFLOW_TOKEN }}
branch: ${{ github.ref }}
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust library (Windows)
run: |
cd decoders_rs
cargo build --release
cd ..
- name: Copy Windows binary
run: mv -Force decoders_rs/target/release/decoders_rs64.dll core/src/main/resources/decoders_rs64.dll

- name: Commit native library
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "GIT_USER_NAME: $GIT_USER_NAME"
echo "GIT_USER_EMAIL: $GIT_USER_EMAIL"
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git pull origin
git add core/src/main/resources/
git diff-index --quiet HEAD || git commit -m "Update Windows natives" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

build-macos:
needs: build-windows
runs-on: macos-latest
strategy:
matrix:
architecture: [arm64]
architecture: [ arm64 ]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust library (MacOS)
run: |
cd decoders_rs
cargo build --release
cd ..
- name: Copy MacOS binary
run: mv -f decoders_rs/target/release/libdecoders_rs64.dylib core/src/main/resources/libdecoders_rsarm64.dylib

- name: Commit native library
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: github-actions[bot]
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
git pull origin
git add core/src/main/resources/
git diff-index --quiet HEAD || git commit -m "Update MacOS natives" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.TF_WORKFLOW_TOKEN }}
branch: ${{ github.ref }}
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust library (MacOS)
run: |
cd decoders_rs
cargo build --release
cd ..
- name: Copy MacOS binary
run: mv -f decoders_rs/target/release/libdecoders_rs64.dylib core/src/main/resources/libdecoders_rsarm64.dylib

- name: Commit native library
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: github-actions[bot]
GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: |
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
git pull origin
git add core/src/main/resources/
git diff-index --quiet HEAD || git commit -m "Update MacOS natives" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
2 changes: 1 addition & 1 deletion decoders_rs/gh_action_trigger.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Change this file if you want to trigger the "build natives" action..
Change this file if you want to trigger the "build natives" action...

0 comments on commit 37fa52f

Please sign in to comment.