Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
Expand Down
76 changes: 43 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: build
name: Build

on: [push, pull_request]
on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
Expand All @@ -9,49 +12,56 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]

steps:
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build --verbose
continue-on-error: ${{ matrix.toolchain != 'stable' }}
- name: Run tests
run: cargo test --verbose
continue-on-error: ${{ matrix.toolchain != 'stable' }}
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --verbose
continue-on-error: ${{ matrix.toolchain != 'stable' }}

- name: Run tests
run: cargo test --verbose
continue-on-error: ${{ matrix.toolchain != 'stable' }}

clippy:
name: clippy (ubuntu-latest, stable)
name: Clippy
runs-on: ubuntu-latest

steps:
- name: Install latest stable
uses: actions-rs/toolchain@v1
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: clippy
- name: Checkout sources
uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: Cargo Clippy

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Run Clippy
run: cargo clippy -- -D warnings -A deprecated

fmt:
name: fmt (ubuntu-latest, stable)
name: Rustfmt
runs-on: ubuntu-latest

steps:
- name: Install latest stable
uses: actions-rs/toolchain@v1
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
override: true
components: rustfmt
- name: Checkout sources
uses: actions/checkout@v2
- name: Check Formatting

- name: Run rustfmt
run: cargo fmt --all -- --check
62 changes: 34 additions & 28 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
name: post-release
name: Post release

on:
push:
tags:
- "v*"
- "v*"

permissions:
contents: read

jobs:
create-release:
permissions:
contents: write # for actions/create-release to create a release
name: create-release
contents: write

name: Create release
runs-on: ubuntu-latest

outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
release_version: ${{ env.RELEASE_VERSION }}

steps:
- name: Get the release version from the tag
shell: bash
if: env.RELEASE_VERSION == ''
run: |
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Generate Release Notes
run: |
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
cat notes-${{ env.RELEASE_VERSION }}.md
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
body_path: notes-${{ env.RELEASE_VERSION }}.md
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Get the release version from the tag
shell: bash
if: env.RELEASE_VERSION == ''
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "Version is: ${{ env.RELEASE_VERSION }}"

- name: Generate release notes
run: |
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
cat notes-${{ env.RELEASE_VERSION }}.md

- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
body_path: notes-${{ env.RELEASE_VERSION }}.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import pathlib
import sys


_STDIO = pathlib.Path("-")


def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", type=pathlib.Path, default="CHANGELOG.md")
Expand All @@ -21,6 +19,7 @@ def main():
else:
with args.input.open() as fh:
lines = fh.readlines()

version = args.tag.lstrip("v")

note_lines = []
Expand All @@ -33,6 +32,7 @@ def main():
note_lines.append(line)

notes = "".join(note_lines).strip()

if args.output == _STDIO:
print(notes)
else:
Expand Down
39 changes: 19 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Project specific stuff
target
# rustfmt
*.bk
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Editor Stuff
*.sublime-project
*.sublime-workspace
.*.swp
*.bak
*~
.vscode
# 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

# System stuff
.DS_Store
.Spotlight-V100
.Trashes
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
.directory
# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Changelog

The format is based on [Keep a Changelog].

[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

<!-- next-header -->
## Unreleased - ReleaseDate
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ To help us help you get pull requests merged quickly and smoothly, open an issue

`cargo-edit` has a moderately comprehensive test suite. Contributions that add/improve tests are awesome. Please add tests for every change.

`cargo-edit` uses [`rustfmt-nightly`](https://github.com/rust-lang-nursery/rustfmt) for formatting and [`clippy`](https://github.com/rust-lang-nursery/rust-clippy) for linting.
`cargo-edit` uses [`rustfmt-nightly`](https://github.com/rust-lang/rustfmt) for formatting and [`clippy`](https://github.com/rust-lang/rust-clippy) for linting.
Loading