Skip to content

Commit f70fceb

Browse files
committed
Merge branch 'master' into v1
2 parents f79f633 + 31af29c commit f70fceb

File tree

14 files changed

+1036
-4993
lines changed

14 files changed

+1036
-4993
lines changed

.eslintrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"env": {
33
"commonjs": true,
44
"es6": true,
5-
"node": true,
6-
"jest": true
5+
"node": true
76
},
87
"extends": "eslint:recommended",
98
"globals": {

.github/workflows/main.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@ jobs:
3333
shell: bash
3434
steps:
3535
- uses: actions/checkout@v2
36-
- run: npm install
36+
- run: npm install --only=prod
3737
- uses: ./
3838
with: ${{ matrix.config }}
3939
id: install
40+
- run: |
41+
echo 'crystal "${{ steps.install.outputs.crystal }}" | shards "${{ steps.install.outputs.shards }}"'
4042
4143
- run: |
4244
crystal eval 'puts "test" + "ing"' | grep 'testing'
4345
- run: |
44-
crystal --version
46+
'${{ steps.install.outputs.path }}/bin/crystal' --version
47+
- run: |
48+
ls '${{ steps.install.outputs.path }}/src/prelude.cr'
4549
- run: |
4650
v='${{ steps.install.outputs.crystal }}'
4751
crystal --version | grep "${v:0:9}"
@@ -70,14 +74,14 @@ jobs:
7074
if: ${{ contains(matrix.config.shards, '.') }}
7175
- run: |
7276
! shards --version
73-
if: ${{ matrix.config.shards == 'false' }}
77+
if: ${{ contains(matrix.config.shards, 'false') }}
78+
- run: |
79+
shards build
80+
working-directory: test-project
81+
if: ${{ !contains('false', matrix.config.shards) }}
7482
7583
test:
76-
strategy:
77-
fail-fast: false
78-
matrix:
79-
os: [ubuntu-latest, macos-latest, windows-latest]
80-
runs-on: ${{ matrix.os }}
84+
runs-on: ubuntu-latest
8185
steps:
8286
- uses: actions/checkout@v2
8387
- run: npm install

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@ jobs:
3333
shell: bash
3434
steps:
3535
- uses: actions/checkout@v2
36-
- run: npm install
36+
- run: npm install --only=prod
3737
- uses: oprypin/install-crystal@v1
3838
with: ${{ matrix.config }}
3939
id: install
40+
- run: |
41+
echo 'crystal "${{ steps.install.outputs.crystal }}" | shards "${{ steps.install.outputs.shards }}"'
4042
4143
- run: |
4244
crystal eval 'puts "test" + "ing"' | grep 'testing'
4345
- run: |
44-
crystal --version
46+
'${{ steps.install.outputs.path }}/bin/crystal' --version
47+
- run: |
48+
ls '${{ steps.install.outputs.path }}/src/prelude.cr'
4549
- run: |
4650
v='${{ steps.install.outputs.crystal }}'
4751
crystal --version | grep "${v:0:9}"
@@ -70,4 +74,8 @@ jobs:
7074
if: ${{ contains(matrix.config.shards, '.') }}
7175
- run: |
7276
! shards --version
73-
if: ${{ matrix.config.shards == 'false' }}
77+
if: ${{ contains(matrix.config.shards, 'false') }}
78+
- run: |
79+
shards build
80+
working-directory: test-project
81+
if: ${{ !contains('false', matrix.config.shards) }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules/
2+
.vscode/

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Development guide
2+
3+
## Trying it out locally
4+
5+
### Example
6+
7+
```bash
8+
tmp=$(mktemp -d) && touch "$tmp"/{path,env}
9+
export RUNNER_TEMP="$tmp" GITHUB_PATH="$tmp/path" GITHUB_ENV="$tmp/env"
10+
env PATH="$(pwd)/.tools:$PATH" INPUT_CRYSTAL=nightly INPUT_SHARDS=true INPUT_TOKEN="$personal_access_token" INSTALL_CRYSTAL_PLATFORM=win32 node index.js
11+
```
12+
13+
## Pre-commit
14+
15+
Make sure that `npm test` passes. A pre-commit hook is available: `git config core.hooksPath .tools/hooks`.
16+
17+
## CI
18+
19+
Continuous testing runs on GitHub Actions. Make sure that _.github/workflows/main.yml_ and _release.yml_ stay in sync, other than the differences that they already have.
20+
21+
## Cutting a release
22+
23+
Switch to _master_ branch, in a clean state. Run `.tools/release.sh x.y.z` (an actual next version number). You will be switched to the _v1_ branch, _node_modules_ will be populated, and a tag will be created. The final command to push all this will be only printed. Run it. After this, a release also needs to be published on GitHub Marketplace.
24+
25+
### _node_modules_
26+
27+
The _node_modules_ directory must not be present in the _master_ branch. _package-lock.json_ will be present, though.

README.md

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
install-crystal
22
===============
33

4-
[GitHub Action][] to **install [Crystal][] programming language**
4+
[GitHub Action][] to **install [Crystal][] programming language** and [Shards][] package manager.
55

66
Works on Ubuntu, macOS, Windows.
77

8-
On Ubuntu and macOS this also installs `shards`. This will be expanded in the future.
9-
108
## Examples
119

1210
```yaml
@@ -20,37 +18,80 @@ steps:
2018
- uses: actions/checkout@v2
2119
- uses: oprypin/install-crystal@v1
2220
with:
23-
crystal: 0.34.0
21+
crystal: 0.35.1
22+
- run: shards install
2423
- run: crystal spec
2524
```
2625
26+
```yaml
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- {os: ubuntu-latest, crystal: latest}
32+
- {os: ubuntu-latest, crystal: nightly}
33+
- {os: macos-latest}
34+
- {os: windows-latest}
35+
runs-on: ${{matrix.os}}
36+
steps:
37+
- uses: oprypin/install-crystal@v1
38+
with:
39+
crystal: ${{matrix.crystal}}
40+
- uses: actions/checkout@v2
41+
- run: shards install
42+
- run: crystal spec
43+
- run: crystal tool format --check
44+
if: matrix.crystal == 'latest'
45+
```
46+
2747
[Find usages in the wild!](https://github.com/search?l=YAML&q=%22oprypin%2Finstall-crystal%22&type=Code)
2848
29-
Alternatively, you can use the container-based approach [as in the starter workflow][crystal-starter] (without this action), but the advantage here is the unified approach to installation across 3 systems.
49+
Alternatively, you can use the container-based approach [as in the starter workflow][crystal-starter] (without this action), but the advantage here is the unified approach to installation across 3 systems. [Using a custom container has disadvantages on its own, too](https://forum.crystal-lang.org/t//2837).
3050
3151
## Usage
3252
3353
### Inputs
3454
35-
* **`crystal: 0.34.0`** (not supported on Windows)
55+
* * **`crystal: 0.35.1`** (not supported on Windows)
56+
57+
Install a particular release of Crystal.
58+
59+
* **`crystal: latest`** (default; not supported on Windows)
60+
61+
Install the latest released version of Crystal.
62+
63+
* **`crystal: nightly`** (default on Windows)
64+
65+
Install Crystal from the latest continuous build on [crystal.git][] master.
3666

37-
Install a particular release of Crystal.
67+
* * **`shards: true`** (default)
3868

39-
* **`crystal: latest`** (default; not supported on Windows)
69+
Ensure that *some* released version of [Shards][] is available.
70+
This uses the build that's bundled with Crystal's releases. Other options are slower, as building Shards is a necessary step then.
4071

41-
Install the latest released version of Crystal.
72+
* **`shards: false`**
4273

43-
* **`crystal: nightly`** (default on Windows)
74+
Ensure that `shards` executable is *not* available.
4475

45-
Install Crystal from the latest continuous build on [crystal.git][] master.
76+
* **`shards: latest`**
77+
78+
Build and install the latest released version of Shards.
79+
80+
* **`shards: 0.13.0`**
81+
82+
Build and install a particular release of Shards.
83+
84+
* **`shards: nightly`**
85+
86+
Build and install the latest commit of [shards.git][] master.
4687

4788
* **`arch: x86_64`**, **`arch: x86`** (defaults to current OS arch)
4889

4990
The architecture of the build of Crystal to download.
5091

5192
* **`destination: some/path`**
5293

53-
The directory to store Crystal in, after extracting.
94+
The directory to store Crystal in, after extracting. Will directly affect `outputs.path` (the default is in a temporary location).
5495

5596
* **`token: ${{ github.token }}`**
5697

@@ -62,8 +103,17 @@ Alternatively, you can use the container-based approach [as in the starter workf
62103

63104
The actual version of Crystal (as a ref in crystal-lang/[crystal.git][]) that was installed.
64105

106+
* **`shards`** (`${{ steps.some_step_id.outputs.shards }}`)
107+
108+
The actual version of Shards (as a ref in crystal-lang/[shards.git][]) that was installed.
109+
110+
* **`path`** (`${{ steps.some_step_id.outputs.path }}`)
111+
112+
The path where Crystal was extracted to, so you can use '[path]/bin/crystal', '[path]/src' etc.
65113

66114
[github action]: https://github.com/features/actions
67115
[crystal]: https://crystal-lang.org/
68116
[crystal.git]: https://github.com/crystal-lang/crystal
117+
[shards]: https://github.com/crystal-lang/shards
118+
[shards.git]: https://github.com/crystal-lang/shards
69119
[crystal-starter]: https://github.com/actions/starter-workflows/blob/master/ci/crystal.yml

action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Install Crystal
22
description: Install Crystal programming language
33
inputs:
44
crystal:
5-
description: The version of Crystal to install ("latest", "nightly", "0.34.0" etc)
5+
description: The version of Crystal to install ("latest", "nightly", "0.35.1" etc)
66
shards:
7-
description: The version of Shards to install (true, "latest", "nightly", "0.12.0" etc)
7+
description: The version of Shards to install (true, "latest", "nightly", "0.13.0" etc)
88
arch:
99
description: The architecture of the build of Crystal ("x86_64")
1010
destination:
@@ -15,6 +15,10 @@ inputs:
1515
outputs:
1616
crystal:
1717
description: The actual version of Crystal that was installed
18+
shards:
19+
description: The actual version of Shards that was installed
20+
path:
21+
description: The directory where Crystal was installed
1822
runs:
1923
using: node12
2024
main: index.js

0 commit comments

Comments
 (0)