-
Notifications
You must be signed in to change notification settings - Fork 8
/
action.yml
136 lines (127 loc) · 5.66 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
name: "Setup Ruby and Rust"
description: "Download a prebuilt Ruby and add it to the PATH in 5 seconds"
author: "Ian Ker-Seymer"
branding:
icon: "download"
color: "gray-dark"
inputs:
ruby-version:
description: "Engine and version to use, see the syntax in the README. Reads from .ruby-version or .tool-versions if unset."
default: "default"
rubygems:
description: |
The version of RubyGems to use. Either 'default' (the default), 'latest', or a version number (e.g., 3.3.5).
For 'default', no action is taken and the version of RubyGems that comes with Ruby by default is used.
For 'latest', `gem update --system` is run to update to the latest RubyGems version.
Similarly, if a version number is given, `gem update --system <version>` is run to update to that version of RubyGems, as long as that version is newer than the one provided by default.
bundler:
description: |
The version of Bundler to install. Either 'Gemfile.lock' (the default), 'default', 'latest', 'none', or a version number (e.g., 1, 2, 2.1, 2.1.4).
For 'Gemfile.lock', the version of the BUNDLED WITH section from the Gemfile.lock if it exists. If the file or section does not exist then the same as 'default'.
For 'default', if the Ruby ships with Bundler 2.2+ as a default gem, that version is used, otherwise the same as 'latest'.
For 'latest', the latest compatible Bundler version is installed (Bundler 2 on Ruby >= 2.3, Bundler 1 on Ruby < 2.3).
For 'none', nothing is done.
bundler-cache:
description: 'Run "bundle install", and cache the result automatically. Either true or false.'
default: "false"
working-directory:
description: "The working directory to use for resolving paths for .ruby-version, .tool-versions and Gemfile.lock."
cache-version:
default: "v0"
description: |
Arbitrary string that will be added to the cache key of the bundler cache. Set or change it if you need
to invalidate the cache.
rustup-toolchain:
description: |
Rustup toolchain specifier e.g. stable, nightly, 1.42.0, nightly-2022-01-01.
default: stable
rustup-targets:
description: |
Comma-separated string of additional targets to install e.g. wasm32-unknown-unknown
default: ""
rustup-components:
description: |
Comma-separated string of additional components to install e.g. clippy, rustfmt
default: clippy, rustfmt
cargo-cache:
description: "Automatically cache the target dir and Cargo registry index"
default: "false"
cargo-cache-extra-path:
description: "Paths to cache for cargo and gem compilation"
default: tmp/
cargo-vendor:
description: "Vendor cargo dependencies to avoid repeated downloads"
default: "false"
outputs:
ruby-prefix:
description: "The prefix of the installed ruby"
runs:
using: "composite"
steps:
- uses: "ruby/setup-ruby@v1"
with:
ruby-version: ${{ inputs.ruby-version }}
rubygems: ${{ inputs.rubygems }}
bundler: ${{ inputs.bundler }}
bundler-cache: ${{ inputs.bundler-cache }}
working-directory: ${{ inputs.working-directory }}
cache-version: ${{ inputs.cache-version }}
- uses: dtolnay/rust-toolchain@master
id: rust-toolchain
if: runner.os != 'Windows'
with:
toolchain: ${{ inputs.rustup-toolchain }}
targets: ${{ inputs.rustup-targets }}
components: ${{ inputs.rustup-components }}
- name: Setup cargo cache
uses: actions/cache@v3
if: inputs.cargo-cache == 'true' && runner.os != 'Windows'
with:
path: ~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
${{ inputs.cargo-cache-extra-path }}
key: compilation-cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ steps.rust-toolchain.outputs.cachekey }}-${{ inputs.ruby-version }}-${{ hashFiles('**/Cargo.lock', '**/extconf.rb', '**/Gemfile.lock') }}
- uses: dtolnay/rust-toolchain@master
id: rust-toolchain-windows
if: runner.os == 'Windows'
with:
toolchain: ${{ inputs.rustup-toolchain }}-x86_64-pc-windows-gnu
targets: ${{ inputs.rustup-targets }}
components: ${{ inputs.rustup-components }}
- name: Setup cargo cache
uses: actions/cache@v3
if: inputs.cargo-cache == 'true' && runner.os == 'Windows'
with:
path: ~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
${{ inputs.cargo-cache-extra-path }}
key: compilation-cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ steps.rust-toolchain-windows.outputs.cachekey }}-${{ inputs.ruby-version }}-${{ hashFiles('**/Cargo.lock', '**/extconf.rb', '**/Gemfile.lock') }}
- name: Fix clang dep for rust-bindgen
if: runner.os == 'Windows'
shell: bash
run: pacman --sync --noconfirm --needed $MINGW_PACKAGE_PREFIX-clang || true
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
shell: pwsh
- name: Fix LD_LIBRARY_PATH for Ruby
if: runner.os == 'Linux'
shell: bash
run: |
libdir="$(ruby -rrbconfig -e 'print RbConfig::CONFIG["libdir"]')"
if [ -z "${DEPLOY_ENV}" ]; then
echo "LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH" >> $GITHUB_ENV
else
echo "LD_LIBRARY_PATH=$libdir" >> $GITHUB_ENV
fi
- name: Vendoring cargo dependencies
if: inputs.cargo-vendor == 'true'
shell: bash
run: mkdir -p .cargo tmp && cargo vendor "$PWD/tmp/cargo-vendor" >> .cargo/config.toml