Add Doc: Don't support external dependency #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ master, dev ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
jobs: | |
build: | |
name: Cargo test (${{ matrix.rust }}) (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
rust: [stable, 1.72] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust ${{ matrix.rust }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/registry | |
key: rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-${{ steps.get-date.outputs.date }}-build | |
restore-keys: | | |
rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | |
rust-${{ runner.os }} | |
# Real tests starts here | |
- name: Check version | |
run: rustup --version && rustc --version && cargo --version | |
- name: Install rustfmt | |
run: | | |
rustup component add rustfmt | |
which rustfmt && rustfmt --version | |
- name: Build | |
run: | | |
cargo build --verbose | |
- name: Run tests | |
run: | | |
cargo test --verbose | |
- name: Install | |
run: | | |
cargo install --path . | |
- name: Package | |
run: | | |
cargo package --verbose | |
- name: clippy | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
rustup component add clippy | |
cargo clippy | |
- name: Run sccache stat for check | |
shell: bash | |
run: ${SCCACHE_PATH} --show-stats | |
coverage: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
rust: [stable] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust ${{ matrix.rust }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/registry | |
key: rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-${{ steps.get-date.outputs.date }}-build | |
restore-keys: | | |
rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | |
rust-${{ runner.os }} | |
- name: Build And Coverage | |
run: ./coverage.sh | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: coverage | |
path: ./coverage/ | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] | |
rust: [stable] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust ${{ matrix.rust }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/registry | |
key: rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-${{ steps.get-date.outputs.date }}-build | |
restore-keys: | | |
rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | |
rust-${{ runner.os }} | |
# End of rust template | |
# - name: Install toolkit | |
# run: cargo install cargo-bump | |
- name: Bump version | |
run: | | |
git config --global user.name 'Endle' | |
git config --global user.email '[email protected]' | |
git branch --show-current | |
python3 --version | |
python3 bump_version.py | |
- name: Push to GitHub | |
run: git push origin master | |
# - name: Push to Github and crates | |
# env: | |
# CRATES_SECRET: ${{ secrets.CRATES_ENDLE }} | |
# run: | | |
# if [[ -f "created_new_commit.success" ]]; then | |
# cat created_new_commit.success | |
# rm created_new_commit.success | |
# echo "Following https://stackoverflow.com/a/58393457/1166518" | |
# git push origin master | |
# cargo login "$CRATES_SECRET" | |
# cargo publish -v | |
# fi | |