Skip to content

Commit

Permalink
ci: install minimal profile (#256)
Browse files Browse the repository at this point in the history
ci: refactor rustup action
  • Loading branch information
Boshen authored Apr 5, 2023
1 parent c35fb19 commit 230c7c8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
47 changes: 27 additions & 20 deletions .github/actions/rustup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,42 @@ inputs:
default: false
required: false
type: boolean
minimal:
default: true
required: false
type: boolean

runs:
using: composite
steps:
- name: Install Rust Toolchain
- name: Remove `profile` line on non-MacOS
shell: bash
if: runner.os == 'macOS'
run: |
# Inherit the channel by removing `profile` line
sed '/profile/d' rust-toolchain.toml | tee rust-toolchain
mv rust-toolchain rust-toolchain.toml
sed -i '' '/profile/d' rust-toolchain.toml
- name: Remove `profile` line on MacOS
shell: bash
if: runner.os != 'macOS'
run: |
sed -i '/profile/d' rust-toolchain.toml
if [ ${{ inputs.minimal }} ]; then
rustup set profile minimal
fi
- name: Set minimal
shell: bash
run: rustup set profile minimal

if [ ${{ inputs.clippy }} ]; then
rustup component add clippy
fi
- name: Add Clippy
shell: bash
if: ${{ inputs.clippy == 'true' }}
run: rustup component add clippy

if [ ${{ inputs.fmt }} ]; then
rustup component add rustfmt
fi
- name: Add Rustfmt
shell: bash
if: ${{ inputs.fmt == 'true' }}
run: rustup component add rustfmt

if [ ${{ inputs.docs }} ]; then
rustup component add rust-docs
fi
- name: Add docs
shell: bash
if: ${{ inputs.docs == 'true' }}
run: rustup component add rust-docs

rustup show
- name: Install
shell: bash
run: rustup show
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
minimal: false
fmt: true

- name: Run rustfmt
Expand Down

0 comments on commit 230c7c8

Please sign in to comment.