Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI workflows #324

Merged
merged 12 commits into from
Jul 6, 2023
74 changes: 24 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,80 +13,54 @@ jobs:
name: run tests
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
rust: ['1.62', stable]
platform: [ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04]
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
toolchain: [stable, 1.62.1]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
with:
toolchain: ${{ matrix.rust }}
profile: minimal
default: true
toolchain: ${{ matrix.toolchain }}
- name: Build with default features
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build
- name: Build with logging and webpki roots
uses: actions-rs/cargo@v1
with:
command: build
args: --features logging,webpki-roots --no-default-features
run: cargo build --features logging,webpki-roots --no-default-features
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
run: cargo test

clippy:
name: run clippy lints
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features logging
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
with:
toolchain: stable
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
components: clippy
- name: run clippy lints
run: cargo clippy --features logging

fmt:
name: run rustfmt
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
with:
toolchain: stable
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
components: rustfmt
- name: run rustfmt
run: cargo fmt --all -- --check

docs:
name: build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.4'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no corresponding use of dtolnay/rust-toolchain for this use of actions-rs/toolchain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the general one is fine in this case as it doesn't impact the time taken by the CI.

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
- name: Ensure that docs can be built
run: cd docs && mdbook build
- name: Generate usage string
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
Expand Down
47 changes: 21 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ on:
push:
tags:
- "v*" # push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
kbdharun marked this conversation as resolved.
Show resolved Hide resolved

jobs:
create-release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Create release for tag
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand All @@ -18,12 +19,12 @@ jobs:
upload-completions:
needs:
- create-release
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
target: ["bash", "fish", "zsh"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Upload completion
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand All @@ -34,12 +35,12 @@ jobs:
upload-license:
needs:
- create-release
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
target: ["MIT", "APACHE"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Upload license
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand All @@ -48,7 +49,7 @@ jobs:
upload_release_file ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${GITHUB_REF#refs/*/} LICENSE-${{ matrix.target }} LICENSE-${{ matrix.target }}.txt

build-linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
include:
Expand All @@ -63,42 +64,36 @@ jobs:
- arch: "arm"
libc: "musleabihf"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Pull Docker image
run: docker pull messense/rust-musl-cross:${{ matrix.arch }}-${{ matrix.libc }}
- name: Build in Docker
run: docker run --rm -i -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${{ matrix.arch }}-${{ matrix.libc }} cargo build --release
- name: Strip binary
run: docker run --rm -i -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${{ matrix.arch }}-${{ matrix.libc }} musl-strip -s /home/rust/src/target/${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}/release/tldr
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "tealdeer-linux-${{ matrix.arch }}-${{ matrix.libc }}"
path: "target/${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}/release/tldr"

build-macos:
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build
uses: actions-rs/cargo@v1
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
with:
command: build
args: --release --target x86_64-apple-darwin --no-default-features --features webpki-roots
- uses: actions/upload-artifact@v2
run: cargo build --release --target x86_64-apple-darwin --no-default-features --features webpki-roots
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/upload-artifact@v3
with:
name: "tealdeer-macos-x86_64"
path: "target/x86_64-apple-darwin/release/tldr"

build-windows:
runs-on: windows-2022
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-pc-windows-msvc
- uses: actions/upload-artifact@v2
run: cargo build --release --target x86_64-pc-windows-msvc
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
kbdharun marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/upload-artifact@v3
with:
name: "tealdeer-windows-x86_64-msvc"
path: "target/x86_64-pc-windows-msvc/release/tldr.exe"
Expand All @@ -109,7 +104,7 @@ jobs:
- build-linux
- build-macos
- build-windows
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
target:
Expand All @@ -121,8 +116,8 @@ jobs:
- macos-x86_64
- windows-x86_64-msvc
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Upload binary
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down