-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
79 lines (66 loc) · 1.98 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Rustup
description: Setup Rust with caching
inputs:
# See https://rust-lang.github.io/rustup/concepts/components.html
components:
required: false
type: string
description: space separated Rust components, e.g. `clippy rustfmt rust-docs`
tools:
required: false
type: string
description: comma separated Cargo tools
restore-cache:
default: true
required: false
type: boolean
description: whether to restore cache
save-cache:
default: false
required: false
type: boolean
description: whether to save cache, e.g. `github.ref_name == 'main'`
cache-key:
default: 'main'
required: false
type: string
description: cache key prefix
runs:
using: composite
steps:
- name: Print Inputs
shell: bash
run: |
echo 'components: ${{ inputs.components }}'
echo 'tools: ${{ inputs.tools }}'
echo 'restore-cache: ${{ inputs.restore-cache }}'
echo 'save-cache: ${{ inputs.save-cache }}'
echo 'cache-key: ${{ inputs.cache-key }}'
- name: Change to minimal profile
shell: bash
run: |
sed -i ${{ (runner.os == 'macOS' && '""') || '' }} -e 's/profile = "default"/profile = "minimal"/g' rust-toolchain.toml
cat rust-toolchain.toml
- name: Set Minimal Profile
shell: bash
run: rustup set profile minimal
- name: Add Components
shell: bash
if: ${{ inputs.components }}
run: rustup component add ${{ inputs.components }}
- name: Install
shell: bash
run: |
rustup show
git restore . # restore rust-toolchain.toml change
- name: Cache on ${{ github.ref_name }}
uses: Swatinem/rust-cache@v2
if: ${{ inputs.restore-cache == 'true' }}
with:
shared-key: ${{ inputs.cache-key }}
save-if: ${{ inputs.save-cache == 'true' }}
- name: Install Tools
uses: taiki-e/install-action@v2
if: ${{ inputs.tools }}
with:
tool: ${{ inputs.tools }}