68 lines
2.8 KiB
YAML
68 lines
2.8 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- local-test
|
|
|
|
jobs:
|
|
build-rust:
|
|
runs-on: joylink-local233-rust
|
|
steps:
|
|
- name: 检出代码
|
|
uses: https://gitea.joylink.club/actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
- uses: https://gitea.joylink.club/actions/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
cache-all-crates: true
|
|
- name: Install musl-tools
|
|
run: apt-get update && apt-get install -y musl-tools
|
|
- name: build Release
|
|
run: |
|
|
echo '[source.crates-io]' > ~/.cargo/config.toml
|
|
echo 'replace-with = "rsproxy-sparse"' >> ~/.cargo/config.toml
|
|
echo '[source.rsproxy]' >> ~/.cargo/config.toml
|
|
echo 'registry = "https://rsproxy.cn/crates.io-index"' >> ~/.cargo/config.toml
|
|
echo '[source.rsproxy-sparse]' >> ~/.cargo/config.toml
|
|
echo 'registry = "sparse+https://rsproxy.cn/index/"' >> ~/.cargo/config.toml
|
|
echo '[registries.rsproxy]' >> ~/.cargo/config.toml
|
|
echo 'index = "https://rsproxy.cn/crates.io-index"' >> ~/.cargo/config.toml
|
|
echo '[net]' >> ~/.cargo/config.toml
|
|
echo 'git-fetch-with-cli = true' >> ~/.cargo/config.toml
|
|
cat $HOME/.cargo/config.toml
|
|
. ~/.bashrc
|
|
echo $PATH
|
|
rustup target add x86_64-unknown-linux-musl
|
|
cargo build --release --target x86_64-unknown-linux-musl
|
|
- name: 设置 Docker
|
|
uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1
|
|
- name: 设置 Docker Buildx
|
|
uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3
|
|
- name: docker登录gitea.joylink.club
|
|
uses: https://gitea.joylink.club/docker/login-action@v3
|
|
with:
|
|
registry: gitea.joylink.club
|
|
username: shengxuqiang
|
|
password: ${{ secrets.SHENGXUQIANG_PASSWORD }}
|
|
- name: Docker Build and push
|
|
uses: https://gitea.joylink.club/docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile-manager
|
|
push: true
|
|
tags: |
|
|
gitea.joylink.club/joylink/rtsam:lt
|
|
- name: 发布到本地测试环境
|
|
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.LOCAL_233_SSH_HOST }}
|
|
port: ${{ secrets.LOCAL_233_SSH_PORT }}
|
|
username: ${{ secrets.LOCAL_233_SSH_USER }}
|
|
password: ${{ secrets.LOCAL_233_SSH_PASSWORD }}
|
|
script: |
|
|
docker rm -f rtsa-manage || echo "rtsa-manage not exist"
|
|
docker pull gitea.joylink.club/joylink/rtsam:lt
|
|
docker run --name rtsa-manage --restart=always -e RUN_MODE=local_test --network jlnet --ip 10.11.11.11 -d -p 8765:8765 -v /usr/local/joylink/logs/simulation:/logs/simulation gitea.joylink.club/joylink/rtsam:lt
|