From 05f4f669a9d8c7d09fbee3a085e4335f2bfedec1 Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Tue, 9 May 2023 16:09:21 +0800 Subject: [PATCH] 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 --- .cargo/config | 5 ---- .gitignore | 3 +- .gitlab-ci.yml | 80 +++++++++++++++++++++++++++++++++----------------- 3 files changed, 55 insertions(+), 33 deletions(-) delete mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index c36c95d..0000000 --- a/.cargo/config +++ /dev/null @@ -1,5 +0,0 @@ -[target.x86_64-unknown-linux-musl] -linker = "x86_64-linux-musl-gcc" - -[target.x86_64-pc-windows-gnu] -linker = "x86_64-w64-mingw32-gcc" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 22ab2e1..792a1aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target config.json logs/ -.DS_Store \ No newline at end of file +.DS_Store +.cargo \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a86eec..e932b5e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,20 @@ stages: - build - - publish + - 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 - script: - - cargo build --release - artifacts: - paths: - - target/release/rua-list - -build:windows-amd64: - stage: build - image: rust:latest + rules: + - if: $CI_COMMIT_TAG script: - mkdir $HOME/.cargo - echo "[source.crates-io]" >> $HOME/.cargo/config @@ -21,38 +22,63 @@ build:windows-amd64: - 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-unknown-linux-musl - 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: - - target/x86_64-pc-windows-gnu/release/rua-list.exe + - 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 -pages: - stage: publish - image: alpine - dependencies: - - build:linux-gnu-amd64 - # - build:linux-musl-amd64 - - rustdoc +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: - - mkdir -p public - - mv target/doc public/doc - - mv target/release/rua-list public/rua-list - artifacts: - paths: - - public - only: - - master \ No newline at end of file + - 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"