Files
rua-list/.gitlab-ci.yml
DefectingCat 05f4f669a9 update git ignore
Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file

Update .gitlab-ci.yml file
2023-05-11 09:10:50 +08:00

85 lines
2.5 KiB
YAML

stages:
- build
- release
build:test:
stage: build
image: rust:latest
script:
- echo 'running release_job'
- echo 'Previous Job ID is printed below'
- echo $CI_JOB_ID
build:linux-gnu-amd64:
stage: build
image: rust:latest
rules:
- if: $CI_COMMIT_TAG
script:
- mkdir $HOME/.cargo
- echo "[source.crates-io]" >> $HOME/.cargo/config
- echo "replace-with = 'ustc'" >> $HOME/.cargo/config
- echo "" >> $HOME/.cargo/config
- echo "[source.ustc]" >> $HOME/.cargo/config
- echo "registry = \"sparse+https://mirrors.ustc.edu.cn/crates.io-index/\"" >> $HOME/.cargo/config
- mkdir public
- cargo build --release
- "mv target/release/rua-list target/release/rua-list-x86_64-unknown-linux-gnu-v$GE_JOB_ID"
- "mv target/release/rua-list-x86_64-unknown-linux-gnu-v$GE_JOB_ID public/"
artifacts:
paths:
- "public/rua-list-x86_64-unknown-linux-gnu-v$GE_JOB_ID"
build:linux-musl-amd64:
stage: build
image: rust:latest
rules:
- if: $CI_COMMIT_TAG
script:
- apt update
- apt install -y musl-tools
- rustup target add x86_64-unknown-linux-musl
- cargo build --release --target x86_64-unknown-linux-musl
- mv target/x86_64-unknown-linux-musl/release/rua-list public/rua-list-x86_64-unknown-linux-musl
artifacts:
paths:
- public/rua-list-x86_64-unknown-linux-musl
build:windows-amd64:
stage: build
image: rust:latest
rules:
- if: $CI_COMMIT_TAG
script:
- apt update
- apt install -y g++-mingw-w64-x86-64
- rustup target add x86_64-pc-windows-gnu
- rustup toolchain install stable-x86_64-pc-windows-gnu
- cargo build --release --target x86_64-pc-windows-gnu
- mv target/x86_64-pc-windows-gnu/release/rua-list.exe public/rua-list-x86_64-pc-windows-gnu.exe
artifacts:
paths:
- public/rua-list-x86_64-pc-windows-gnu.exe
rustdoc:
stage: build
image: rust
rules:
- if: $CI_COMMIT_TAG
script:
- cargo doc
artifacts:
paths:
- target/doc
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: "$CI_COMMIT_TAG"
description: "$CI_COMMIT_TAG"