mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-04 03:05:39 +00:00
设置ci流水线
This commit is contained in:
@@ -22,17 +22,7 @@ ENV RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
|
|||||||
RUN curl -o rustup-init.sh --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh \
|
RUN curl -o rustup-init.sh --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh \
|
||||||
&& sh rustup-init.sh -y && rm -rf rustup-init.sh
|
&& sh rustup-init.sh -y && rm -rf rustup-init.sh
|
||||||
|
|
||||||
RUN echo "[source.crates-io]" > /root/.cargo/config.toml \
|
COPY .docker/cargo.config.toml /root/.cargo/config.toml
|
||||||
&& echo "registry = \"https://github.com/rust-lang/crates.io-index\"" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "replace-with = \"rsproxy-sparse\"" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "[source.rsproxy]" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "registry = \"https://rsproxy.cn/crates.io-index\"" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "[source.rsproxy-sparse]" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "registry = \"sparse+https://rsproxy.cn/index/\"" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "[registries.rsproxy]" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "index = \"https://rsproxy.cn/crates.io-index\"" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "[net]" >> /root/.cargo/config.toml \
|
|
||||||
&& echo "git-fetch-with-cli = true" >> /root/.cargo/config.toml
|
|
||||||
|
|
||||||
WORKDIR /root/s3-rustfs
|
WORKDIR /root/s3-rustfs
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[source.crates-io]
|
||||||
|
registry = "https://github.com/rust-lang/crates.io-index"
|
||||||
|
replace-with = 'rsproxy-sparse'
|
||||||
|
|
||||||
|
[source.rsproxy]
|
||||||
|
registry = "https://rsproxy.cn/crates.io-index"
|
||||||
|
[registries.rsproxy]
|
||||||
|
index = "https://rsproxy.cn/crates.io-index"
|
||||||
|
[source.rsproxy-sparse]
|
||||||
|
registry = "sparse+https://rsproxy.cn/index/"
|
||||||
|
|
||||||
|
[net]
|
||||||
|
git-fetch-with-cli = true
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
name: Rust
|
name: Rust
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
@@ -11,12 +11,48 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
rust:
|
||||||
|
- stable
|
||||||
|
- beta
|
||||||
|
- nightly
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: cache protoc bin
|
||||||
- name: Build
|
id: cache-protoc-action
|
||||||
run: cargo build --verbose
|
uses: actions/cache@v3
|
||||||
- name: Run tests
|
env:
|
||||||
run: cargo test --verbose
|
cache-name: cache-protoc-action-bin
|
||||||
|
with:
|
||||||
|
path: /usr/local/bin/protoc
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-v0.0.1
|
||||||
|
|
||||||
|
- name: install protoc
|
||||||
|
if: steps.cache-protoc-action.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip
|
||||||
|
unzip protoc-27.0-linux-x86_64.zip -d protoc3
|
||||||
|
mv protoc3/bin/* /usr/local/bin/
|
||||||
|
chmod +x /usr/local/bin/protoc
|
||||||
|
rm -rf protoc-27.0-linux-x86_64.zip protoc3
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: ${{ matrix.rust }}
|
||||||
|
override: true
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --verbose
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --all --verbose
|
||||||
|
|||||||
@@ -5,10 +5,11 @@
|
|||||||
DOCKER_CLI ?= docker
|
DOCKER_CLI ?= docker
|
||||||
IMAGE_NAME ?= rustfs:v1.0.0
|
IMAGE_NAME ?= rustfs:v1.0.0
|
||||||
CONTAINER_NAME ?= rustfs-dev
|
CONTAINER_NAME ?= rustfs-dev
|
||||||
|
DOCKERFILE ?= $(shell pwd)/.docker/Dockerfile.devenv
|
||||||
|
|
||||||
.PHONY: init
|
.PHONY: init-devenv
|
||||||
init:
|
init-devenv:
|
||||||
$(DOCKER_CLI) build -t $(IMAGE_NAME) .
|
$(DOCKER_CLI) build -t $(IMAGE_NAME) -f $(DOCKERFILE) .
|
||||||
$(DOCKER_CLI) stop $(CONTAINER_NAME)
|
$(DOCKER_CLI) stop $(CONTAINER_NAME)
|
||||||
$(DOCKER_CLI) rm $(CONTAINER_NAME)
|
$(DOCKER_CLI) rm $(CONTAINER_NAME)
|
||||||
$(DOCKER_CLI) run -d --name $(CONTAINER_NAME) -p 9010:9010 -p 9000:9000 -v $(shell pwd):/root/s3-rustfs -it $(IMAGE_NAME)
|
$(DOCKER_CLI) run -d --name $(CONTAINER_NAME) -p 9010:9010 -p 9000:9000 -v $(shell pwd):/root/s3-rustfs -it $(IMAGE_NAME)
|
||||||
@@ -16,3 +17,7 @@ init:
|
|||||||
.PHONY: start
|
.PHONY: start
|
||||||
start:
|
start:
|
||||||
$(DOCKER_CLI) start $(CONTAINER_NAME)
|
$(DOCKER_CLI) start $(CONTAINER_NAME)
|
||||||
|
|
||||||
|
.PHONY: stop
|
||||||
|
stop:
|
||||||
|
$(DOCKER_CLI) stop $(CONTAINER_NAME)
|
||||||
|
|||||||
Reference in New Issue
Block a user