From 45af0f8c5ce79a688bbfc7bb493675e34e3ee3fd Mon Sep 17 00:00:00 2001 From: amrbashir Date: Thu, 27 Oct 2022 20:01:24 +0200 Subject: [PATCH] ci: add covector, audit, clippy and fmt --- .changes/config.json | 48 ++++++++++++++ .changes/readme.md | 29 +++++++++ .github/workflows/audit.yml | 34 ++++++++++ .github/workflows/change-status-on-PR.yml | 20 ++++++ .github/workflows/clippy-fmt.yml | 51 +++++++++++++++ .../workflows/covector-version-or-publish.yml | 62 +++++++++++++++++++ 6 files changed, 244 insertions(+) create mode 100644 .changes/config.json create mode 100644 .changes/readme.md create mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/change-status-on-PR.yml create mode 100644 .github/workflows/clippy-fmt.yml create mode 100644 .github/workflows/covector-version-or-publish.yml diff --git a/.changes/config.json b/.changes/config.json new file mode 100644 index 0000000..b264d5e --- /dev/null +++ b/.changes/config.json @@ -0,0 +1,48 @@ +{ + "gitSiteUrl": "https://www.github.com/tauri-apps/muda/", + "timeout": 3600000, + "pkgManagers": { + "rust": { + "version": true, + "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -", + "publish": [ + { + "command": "cargo package --no-verify", + "dryRunCommand": true + }, + { + "command": "echo '
\n

Cargo Publish

\n\n```'", + "dryRunCommand": true, + "pipe": true + }, + { + "command": "cargo publish", + "dryRunCommand": "cargo publish --dry-run", + "pipe": true + }, + { + "command": "echo '```\n\n
\n'", + "dryRunCommand": true, + "pipe": true + } + ], + "postpublish": [ + "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f", + "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f", + "git push --tags -f" + ] + } + }, + "packages": { + "muda": { + "path": ".", + "manager": "rust", + "assets": [ + { + "path": "${ pkg.path }/target/package/create-tauri-app-${ pkgFile.version }.crate", + "name": "${ pkg.pkg }-${ pkgFile.version }.crate" + } + ] + } + } +} \ No newline at end of file diff --git a/.changes/readme.md b/.changes/readme.md new file mode 100644 index 0000000..b969dbd --- /dev/null +++ b/.changes/readme.md @@ -0,0 +1,29 @@ +# Changes + +##### via https://github.com/jbolda/covector + +As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend it represents the overall change for our sanity. + +When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. + +Use the following format: + +```md +--- +"muda": patch +--- + +Change summary goes here +``` + +Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed. + +Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/). + +Given a version number MAJOR.MINOR.PATCH, increment the: + +- MAJOR version when you make incompatible API changes, +- MINOR version when you add functionality in a backwards compatible manner, and +- PATCH version when you make backwards compatible bug fixes. + +Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing). diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..f734111 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,34 @@ +# Copyright 2019-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: audit + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + push: + branches: + - dev + paths: + - 'Cargo.lock' + - 'Cargo.toml' + pull_request: + paths: + - 'Cargo.lock' + - 'Cargo.toml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: rust audit + uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/change-status-on-PR.yml b/.github/workflows/change-status-on-PR.yml new file mode 100644 index 0000000..ae7e789 --- /dev/null +++ b/.github/workflows/change-status-on-PR.yml @@ -0,0 +1,20 @@ +# Copyright 2019-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: covector status +on: [pull_request] + +jobs: + covector: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: covector status + uses: jbolda/covector/packages/action@covector-v0 + id: covector + with: + command: "status" diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml new file mode 100644 index 0000000..72c3fb7 --- /dev/null +++ b/.github/workflows/clippy-fmt.yml @@ -0,0 +1,51 @@ +# Copyright 2019-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: clippy & fmt + +on: + push: + branches: + - dev + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: clippy + + - name: clippy + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-targets --all-features -- -D warnings + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: fmt + + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check \ No newline at end of file diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml new file mode 100644 index 0000000..5645b3d --- /dev/null +++ b/.github/workflows/covector-version-or-publish.yml @@ -0,0 +1,62 @@ +# Copyright 2019-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: version or publish + +on: + push: + branches: + - dev + +jobs: + version-or-publish: + runs-on: ubuntu-latest + timeout-minutes: 65 + outputs: + change: ${{ steps.covector.outputs.change }} + commandRan: ${{ steps.covector.outputs.commandRan }} + successfulPublish: ${{ steps.covector.outputs.successfulPublish }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: pnpm/action-setup@v2.2.2 + with: + version: 7 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + check-latest: true + registry-url: 'https://registry.npmjs.org' + + - name: cargo login + run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} + - name: git config + run: | + git config --global user.name "${{ github.event.pusher.name }}" + git config --global user.email "${{ github.event.pusher.email }}" + + - name: covector version or publish (publish when no change files present) + uses: jbolda/covector/packages/action@covector-v0 + id: covector + env: + NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + command: 'version-or-publish' + createRelease: true + + - name: Create Pull Request With Versions Bumped + if: steps.covector.outputs.commandRan == 'version' + uses: tauri-apps/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: release/version-updates + title: Apply Version Updates From Current Changes + commit-message: 'apply version updates' + labels: 'version updates' + body: ${{ steps.covector.outputs.change }} \ No newline at end of file