From c9d37f41ac95bce180cd7b5699185ef945d82ea1 Mon Sep 17 00:00:00 2001 From: core Date: Thu, 28 Dec 2023 00:41:08 -0500 Subject: [PATCH] trifidapi CI builds --- .forgejo/workflows/trifid_api.yml | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .forgejo/workflows/trifid_api.yml diff --git a/.forgejo/workflows/trifid_api.yml b/.forgejo/workflows/trifid_api.yml new file mode 100644 index 0000000..30f390b --- /dev/null +++ b/.forgejo/workflows/trifid_api.yml @@ -0,0 +1,73 @@ +on: + push: + branches: + master +env: + CARGO_TERM_COLOR: always +jobs: + build_x64: + runs_on: docker + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Rust toolchain + uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Install additional dependencies + run: apt update && apt-get install -y libclang-dev clang sshpass rsync + - name: Compile release binary + uses: https://github.com/actions-rs/cargo@v1 + with: + command: build + args: --bin trifid-api --profile release-ci + - name: Upload binary + run: sshpass -p "${{ secrets.TRIFID_DLCDN_PASSWORD }}" rsync --mkpath -e 'ssh -p ${{ secrets.TRIFID_DLCDN_PORT }} -o StrictHostKeyChecking=no' target/release-ci/trifid-api ${{ secrets.TRIFID_DLCDN_USER }}@${{ secrets.TRIFID_DLCDN_IP }}:${{ secrets.TRIFID_DLCDN_PATH }}/trifid-api/amd64/$GITHUB_SHA/trifid-api + build_arm64: + runs_on: docker-arm64 + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Rust toolchain + uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Install aarch64 target + run: rustup target add aarch64-unknown-linux-gnu + - name: Install additional dependencies + run: apt update && apt-get install -y libclang-dev clang sshpass rsync gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu + - name: Compile release binary + uses: https://github.com/actions-rs/cargo@v1 + env: + RUSTFLAGS: "-C linker=aarch64-linux-gnu-gcc" + with: + command: build + args: --bin trifid-api --target aarch64-unknown-linux-gnu --profile release-ci + - name: Upload binary + run: sshpass -p "${{ secrets.TRIFID_DLCDN_PASSWORD }}" rsync --mkpath -e 'ssh -p ${{ secrets.TRIFID_DLCDN_PORT }} -o StrictHostKeyChecking=no' target/aarch64-unknown-linux-gnu/release-ci/trifid-api ${{ secrets.TRIFID_DLCDN_USER }}@${{ secrets.TRIFID_DLCDN_IP }}:${{ secrets.TRIFID_DLCDN_PATH }}/trifid-api/arm64/$GITHUB_SHA/trifid-api + build_win64: + runs_on: docker + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Rust toolchain + uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Install cross-compilation toolchain + run: rustup target add x86_64-pc-windows-gnu + - name: Install additional dependencies + run: apt update && apt-get install -y libclang-dev clang sshpass rsync mingw-w64 zip + - name: Compile release binary + uses: https://github.com/actions-rs/cargo@v1 + with: + command: build + args: --bin trifid-api --target x86_64-pc-windows-gnu --profile release-ci + - name: Upload binary + run: sshpass -p "${{ secrets.TRIFID_DLCDN_PASSWORD }}" rsync --mkpath -e 'ssh -p ${{ secrets.TRIFID_DLCDN_PORT }} -o StrictHostKeyChecking=no' target/x86_64-pc-windows-gnu/release-ci/trifid-api.zip ${{ secrets.TRIFID_DLCDN_USER }}@${{ secrets.TRIFID_DLCDN_IP }}:${{ secrets.TRIFID_DLCDN_PATH }}/trifid-api/win64/$GITHUB_SHA/trifid-api.zip