generated from pot-app/pot-app-collection-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fe8ec82
Showing
14 changed files
with
2,188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM rust:buster | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod a+x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: 'Build for Linux' | ||
branding: | ||
icon: user-check | ||
color: gray-dark | ||
inputs: | ||
target: | ||
required: true | ||
description: 'Rust Target' | ||
toolchain: | ||
required: true | ||
description: 'Rust Toolchain' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.target }} | ||
- ${{ inputs.toolchain }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
cargo build --target "$INPUT_TARGET" --release | ||
mv target/$INPUT_TARGET/release/libplugin.so ./plugin.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
rustup target add "$INPUT_TARGET" | ||
rustup toolchain install --force-non-host "$INPUT_TOOLCHAIN" | ||
apt-get install pkg-config | ||
|
||
if [ "$INPUT_TARGET" = "x86_64-unknown-linux-gnu" ]; then | ||
apt-get update | ||
apt-get install -y libssl-dev | ||
elif [ "$INPUT_TARGET" = "i686-unknown-linux-gnu" ]; then | ||
dpkg --add-architecture i386 | ||
apt-get update | ||
apt-get install -y libstdc++6:i386 libatomic1:i386 gcc-multilib g++-multilib libssl-dev:i386 | ||
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH | ||
export PKG_CONFIG_SYSROOT_DIR=/ | ||
elif [ "$INPUT_TARGET" = "aarch64-unknown-linux-gnu" ]; then | ||
sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | tee /etc/apt/sources.list.d/ports.list | ||
sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list | ||
dpkg --add-architecture arm64 | ||
apt-get update | ||
apt-get install -y libncurses6:arm64 libtinfo6:arm64 linux-libc-dev:arm64 libncursesw6:arm64 libcups2:arm64 | ||
apt-get install -y --no-install-recommends g++-aarch64-linux-gnu libc6-dev-arm64-cross libssl-dev:arm64 | ||
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | ||
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc | ||
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | ||
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig | ||
export PKG_CONFIG_ALLOW_CROSS=1 | ||
elif [ "$INPUT_TARGET" = "armv7-unknown-linux-gnueabihf" ]; then | ||
sed 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | tee /etc/apt/sources.list.d/ports.list | ||
sed -i 's/http:\/\/\(.*\).ubuntu.com\/ubuntu\//[arch=amd64,i386] http:\/\/\1.archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list | ||
dpkg --add-architecture armhf | ||
apt-get update | ||
apt-get install -y libncurses6:armhf libtinfo6:armhf linux-libc-dev:armhf libncursesw6:armhf libcups2:armhf | ||
apt-get install -y --no-install-recommends g++-arm-linux-gnueabihf libc6-dev-armhf-cross libssl-dev:armhf libwebkit2gtk-4.0-dev:armhf libgtk-3-dev:armhf patchelf:armhf librsvg2-dev:armhf | ||
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc | ||
export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc | ||
export CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ | ||
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig | ||
export PKG_CONFIG_ALLOW_CROSS=1 | ||
else | ||
echo "Unknown target: $INPUT_TARGET" && exit 1 | ||
fi | ||
|
||
bash .github/build-for-linux/build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
name: Build | ||
on: push | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
name: ${{ steps.getname.outputs.NAME }} | ||
icon: ${{ steps.getname.outputs.ICON }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Rust Stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: check | ||
run: cargo check --all --all-targets | ||
- name: Install zip | ||
run: sudo apt-get install -y zip jq | ||
- id: getname | ||
run: | | ||
echo "NAME=$(cat info.json | jq '.id' | tr -d '"')" >> "$GITHUB_OUTPUT" | ||
echo "ICON=$(cat info.json | jq '.icon' | tr -d '"')" >> "$GITHUB_OUTPUT" | ||
build-for-windows: | ||
needs: check | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [windows-latest] | ||
target: | ||
[ | ||
x86_64-pc-windows-msvc, | ||
i686-pc-windows-msvc, | ||
aarch64-pc-windows-msvc, | ||
] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Rust Stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: install toolchain | ||
run: | | ||
rustup target add ${{ matrix.target }} | ||
rustup toolchain install --force-non-host stable-${{ matrix.target }} | ||
- name: Build | ||
run: cargo build --release --target ${{ matrix.target }} | ||
- name: Rename | ||
run: move target/${{ matrix.target }}/release/plugin.dll ./plugin.dll | ||
- uses: vimtor/action-zip@v1 | ||
with: | ||
files: info.json ${{needs.check.outputs.icon}} plugin.dll | ||
dest: ${{needs.check.outputs.name}}.potext | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: "*.potext" | ||
if-no-files-found: error | ||
- name: Wrap | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: vimtor/action-zip@v1 | ||
with: | ||
files: ${{needs.check.outputs.name}}.potext | ||
dest: ${{ matrix.target }}.zip | ||
- name: Upload Release | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.TOKEN }} | ||
files: ${{ matrix.target }}.zip | ||
build-for-macos: | ||
needs: check | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest] | ||
target: [x86_64-apple-darwin, aarch64-apple-darwin] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Rust Stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: install toolchain | ||
run: | | ||
rustup target add ${{ matrix.target }} | ||
rustup toolchain install --force-non-host stable-${{ matrix.target }} | ||
- name: Build | ||
run: cargo build --release --target ${{ matrix.target }} | ||
- name: Rename | ||
run: sudo mv target/${{ matrix.target }}/release/libplugin.dylib ./plugin.dylib | ||
- uses: vimtor/action-zip@v1 | ||
with: | ||
files: info.json ${{needs.check.outputs.icon}} plugin.dylib | ||
dest: ${{needs.check.outputs.name}}.potext | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: "*.potext" | ||
if-no-files-found: error | ||
- name: Wrap | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: vimtor/action-zip@v1 | ||
with: | ||
files: ${{needs.check.outputs.name}}.potext | ||
dest: ${{ matrix.target }}.zip | ||
- name: Upload Release | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.TOKEN }} | ||
files: ${{ matrix.target }}.zip | ||
build-for-linux: | ||
needs: check | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ubuntu-latest] | ||
target: | ||
[ | ||
x86_64-unknown-linux-gnu, | ||
i686-unknown-linux-gnu, | ||
aarch64-unknown-linux-gnu, | ||
armv7-unknown-linux-gnueabihf, | ||
] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Build for Linux | ||
uses: ./.github/build-for-linux | ||
with: | ||
target: ${{ matrix.target }} | ||
toolchain: stable-${{ matrix.target }} | ||
- uses: vimtor/action-zip@v1 | ||
with: | ||
files: info.json ${{needs.check.outputs.icon}} plugin.so | ||
dest: ${{needs.check.outputs.name}}.potext | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: "*.potext" | ||
if-no-files-found: error | ||
- name: Wrap | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: vimtor/action-zip@v1 | ||
with: | ||
files: ${{needs.check.outputs.name}}.potext | ||
dest: ${{ matrix.target }}.zip | ||
- name: Upload Release | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.TOKEN }} | ||
files: ${{ matrix.target }}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
Oops, something went wrong.