From 3cec0588c6fcea1ae6c4fdcd549a6b1ee08e417f Mon Sep 17 00:00:00 2001 From: PFC <81114960+PFC-developer@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:34:25 -0500 Subject: [PATCH] feat: add .github actions --- .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++ .github/PULL_REQUEST_TEMPLATE.md | 17 +++++++ .github/workflows/release-artifacts.yml | 37 ++++++++++++++ .github/workflows/tests.yml | 61 +++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/release-artifacts.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..cdeb879 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ +## 👀 What is Changed? + + * + +## 📣 API Changes + + * + +## 📝 Notes + + * + +## ☑️ Checklist + - [ ] The code compiles successfully + - [ ] I've run `cargo clippy` to lint and check code style + - [ ] I've written the test code and runs successfully + - [ ] I've updated API docs and noticed to the co-workers for updates diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml new file mode 100644 index 0000000..787cddc --- /dev/null +++ b/.github/workflows/release-artifacts.yml @@ -0,0 +1,37 @@ +name: Release Artifacts + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 + - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 + +jobs: + release-artifacts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt, clippy + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Generate Cargo.lock + run: | + cargo build --workspace + cargo fetch --verbose + - name: Build Artifacts + run: | + docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/workspace-optimizer:0.15.1 + tar -zcvf cosmwasm-artifacts.tar.gz artifacts + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: cosmwasm-artifacts.tar.gz + body_path: CHANGELOG.md diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..58f0e6f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,61 @@ +name: Formatting Check & Test + +on: + pull_request: + push: + branches: + - main + - develop + - "release/*" + +jobs: + clippy: + name: Actions - clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + profile: minimal + override: true + - run: cargo fetch --verbose + - run: cargo clippy --all --all-targets -- -D warnings + + rustfmt: + name: Actions - rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: rustfmt + profile: minimal + override: true + - run: cargo +nightly fmt -- --check + + unit-test: + name: Actions - unit test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest ] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + - run: cargo fetch --verbose + - run: cargo build + - run: cargo test --verbose --all + env: + RUST_BACKTRACE: 1