Skip to content

Commit

Permalink
updates in github actions (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks-D authored Dec 19, 2023
1 parent 7e4a560 commit c62676d
Show file tree
Hide file tree
Showing 11 changed files with 1,251 additions and 47 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust format, test and build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Format
run: cargo fmt --all -- --check
- name: Format
run: cargo clippy --all-targets -- -D warnings
- name: Run tests
run: cargo test --verbose
38 changes: 0 additions & 38 deletions .github/workflows/fmt_build_test.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release to crates.io

on:
push:
tags: ["retrying-v[0-9]+.*"]

jobs:
validate-release-tag:
name: Validate git tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: compare git tag with cargo metadata for retrying-core
run: |
PUSHED_TAG=${GITHUB_REF##*/}
CURR_VER=$( grep version ./crates/retrying-core/Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
if [[ "${PUSHED_TAG}" != "v${CURR_VER}" ]]; then
echo "Cargo metadata (/crates/retrying/Cargo.toml) has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
exit 1
fi
- name: compare git tag with cargo metadata for retrying
run: |
PUSHED_TAG=${GITHUB_REF##*/}
CURR_VER=$( grep version ./crates/retrying/Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
if [[ "${PUSHED_TAG}" != "v${CURR_VER}" ]]; then
echo "Cargo metadata (/crates/retrying/Cargo.toml) has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
exit 1
fi
test:
needs: validate-release-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Format
run: cargo fmt --all -- --check
- name: Format
run: cargo clippy --all-targets -- -D warnings
- name: Run tests
run: cargo test --verbose

release:
needs: test
name: Release crate
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# - name: cargo publish retrying-core to crates.io
# run: cargo +stable publish --token $CARGO_REGISTRY_TOKEN --all-features -p retrying-core
- name: cargo publish retrying to crates.io
run: cargo +stable publish --token $CARGO_REGISTRY_TOKEN --all-features -p retrying
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

**Implemented enhancements:**

- Initial implementation of retry macros [commit](https://github.com/dintegrity/retrying/commit/f05bce687bec55ed74bce649b057e6ccc3be543f)
- Initial implementation of retry macros
-

**Fixed bugs:**
Expand Down
Loading

0 comments on commit c62676d

Please sign in to comment.