GithubHelp home page GithubHelp logo

crystal-lang / install-crystal Goto Github PK

View Code? Open in Web Editor NEW
68.0 12.0 8.0 9.72 MB

GitHub Action: Install Crystal programming language

Home Page: https://crystal-lang.github.io/install-crystal/configurator.html

License: MIT License

Shell 3.53% JavaScript 96.27% Crystal 0.20%
github-actions crystal shards

install-crystal's People

Contributors

beta-ziliani avatar kimburgess avatar oprypin avatar renovate[bot] avatar straight-shoota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

install-crystal's Issues

Dependencies inconsistency

The actions explicitly installs some dependencies such as libssl-dev on Linux, but not on macOS (on Windows, the libraries are already included in the Crystal package).
This causes some inconsistency because after installing with this action, a program linking against libssl compiles fine on Linux, but not on macOS.

Example for such a failure: https://github.com/crystal-lang/test-ecosystem/actions/runs/5400167770/jobs/9808241746 (the workflow succeeds on Linux and Windows, but not on macOS).

Should this action install some dependencies on macOs as well?

mac: Nightly builds failing

Looking for latest Crystal build
Found Crystal build https://circleci.com/gh/crystal-lang/crystal/64039
Error: TypeError: Cannot read property 'url' of undefined

Download fails when a release is missing binary artifacts

When making a Crystal release, we first tag a commit and publish a release on GitHub. The build pipeline only start after that has happend, and artifacts such as the distribution packages are added as soon as the pipeline has finished. During this time frame, the release has no binary packages attached and install-crystal for latest fails because there's no package to download.

Example: https://github.com/crystal-lang/shards/runs/6133683332

Installing package dependencies
Looking for crystal-lang/crystal-lang release (latest)
sudo -n apt-get install -qy --no-install-recommends --no-upgrade -- libevent-dev libgmp-dev libpcre3-dev libssl-dev libxml2-dev libyaml-dev
Getting Crystal release (1.4.1)
Found Crystal release https://github.com/crystal-lang/crystal/releases/tag/1.4.1

Error: TypeError: Cannot read property 'url' of undefined

The time frame is not that long (it usually takes about 1 hour for the distribution packages to appear), but it's still bad to have all actions during that time. And there could always be unforseeable issues causing delays. So it's better to be safe.

A fix should be relatively easy. If there's no download available, we can circle back and try the second to last release.

unquoted version, set version as string

The configurator recommend the usage of unquoted version.

image

But using float typo in YAML for versions is unsafe. For example, 1.10 will be cast to 1.1, which is a totally different version.

I experienced the issue for this use case:

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        crystal: [1.7, 1.8, 1.9, 1.10, 1.11, 1.12]
    runs-on: ${{ matrix.os }}

image

The solution is to use quote.

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        crystal: ['1.7', '1.8', '1.9', '1.10', '1.11', '1.12']

A similar issue arise long ago in YAML with docker, when mapping port 80:8080 need to be quoted to avoid misinterpretation (see the note.

'When mapping ports in the HOST:CONTAINER format, you may experience erroneous results when using a container port lower than 60, because YAML parses numbers in the format xx:yy as a base-60 value. For this reason, we recommend always explicitly specifying your port mappings as strings.'

TL;DR: set version as string in the configurator and documentation examples

Shards executable is missing on Windows

Using the v1.3.0 and performing a install on windows-latest is installing the Crystal, but no shards executable.

jobs:
  build:
    timeout-minutes: 30
    strategy:
      fail-fast: false
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2
    - name: Install Crystal
      uses: oprypin/[email protected]
    - name: Install dependencies
      run: shards install
    - name: Run tests
      run: crystal spec
Run oprypin/[email protected]
Looking for latest Crystal build
Found Crystal release https://github.com/crystal-lang/crystal/actions/runs/814765503
Downloading Crystal source for 421fa11bf05b11441b74bbeb2762b673f96fec3f
Downloading Crystal build
Extracting Crystal source
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\0851894a-7039-4417-8ed2-de84da05df38', 'D:\a\_temp\aaa78362-e1f5-4afd-af11-a10070374271')"
Extracting Crystal build
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\645e2361-e87d-48de-8ca4-9fbbd7f39bc1', 'D:\a\_temp\aaa78362-e1f5-4afd-af11-a10070374271\crystal-lang-crystal-421fa11')"
Setting up environment for Crystal
cmd /c "set && echo --- && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" >nul && set"
crystal --version
Crystal 1.1.0-dev (2021-05-05)

LLVM: 10.0.0
Default target: x86_64-pc-windows-msvc

Run shards install
shards: D:\a\_temp\f3017ae0-7a1b-4a7a-b0d0-78cc0768de1f.ps1:2
Line |
   2 |  shards install
     |  ~~~~~~
     | The term 'shards' is not recognized as a name of a cmdlet, function, script file, or executable
     | program. Check the spelling of the name, or if a path was included, verify that the path is correct
     | and try again.

Error: Process completed with exit code 1.

Add ability to install maintenance builds

I'd like for this action to provide an option for installing arbitrary maintenance builds instead of just nightlies.
This would be useful for testing against the current state of a release branch or a specific feature branch and could be helpful for testing particular shards directly.
Another use case would be test-ecosystem where we're testing new compiler versions and features against core parts of the Crystal ecosystem.
The old test harness runs a compiler build in test-ecosystem itself. I'm in the process of restructuring and simplifying this process (crystal-lang/test-ecosystem#45). If we could re-use existing maintenance builds for this, it would cut some extra effort there. Enhancing this action for that purpose would be a great tool for that and it shouldn't be hard.

Currently the install action can fetch nightly build artifacts when the value of the Crystal version is set to nightly. This works by querying for the last successful run of the dist_artifacts job no circle CI (Linux/macOS) or the win.yml workflow on GitHub (Windows), each on master branch.
Enabling support for maintenance builds should not require anything else allowing to modify the branch for these queries. Instead of master, one could chose any branch that runs the maintenance release workflow.

I think the configuration could allow free-form values for the crystal version property. Anything that is not nightly or a version tag would be understood as a branch name.
If we want more explicitness, maybe a prefix like branch: could be a requirement?

macos-latest missing SSL

Hi!
macOS action started to fail a few days ago.

Run crystal spec
  crystal spec
  shell: /bin/bash -e {0}
  env:
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
ld: library not found for -lssl (this usually means you need to install the development package for libssl)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc "${@}" -o /Users/runner/.cache/crystal/crystal-run-spec.tmp  -rdynamic -L/Users/runner/work/_temp/crystal-latest-true-undefined/embedded/lib -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre -lgc -lpthread -L/usr/local/Cellar/libevent/2.1.12/lib -levent -liconv -ldl`
Error: Process completed with exit code 1.

https://github.com/mamantoha/crest/runs/3773344842?check_suite_focus=true

Including optional shard installation

First of all, thank you for providing this amazing GitHub Action! It's been a really great addition to my CI workflows.

Something I've found a lot of value in with the ruby/setup-ruby action is the ability to run bundle install and cache the gems as a part of the action with the bundler-cache: true option.

Is something like a shards-cache: true option something that the maintainers would be open to as a part of this action? I haven't worked with writing GitHub actions before, so I wanted to make sure there was an appetite to review a PR before taking the time to learn and implement one.

This would reduce the common copy-and-paste that I do to every Crystal project, which generally does these steps every time:

steps:
  - uses: actions/[email protected]

  - uses: crystal-lang/install-crystal@v1
    with:
      crystal: latest

  - name: Set up Crystal cache
    uses: actions/[email protected]
    id: crystal-cache
    with:
      path: |
        ~/.cache/crystal
        bin/ameba
        lib
      key: ${{ runner.os }}-crystal-${{ matrix.crystal_version }}-${{ hashFiles('**/shard.lock') }}
      restore-keys: |
        ${{ runner.os }}-crystal-${{ matrix.crystal_version }}

  - name: Install shards
    if: steps.crystal-cache.outputs.cache-hit != 'true'
    run: shards check || shards install --ignore-crystal-version

  - name: Run tests
    run: crystal spec

My hope would be that these steps could be reduced to (naming TBD):

steps:
  - uses: actions/[email protected]

  - uses: crystal-lang/install-crystal@v1
    with:
      crystal: latest
      shards-cache: true
      shards-cache-ignore-crystal-version: true
      shards-cache-additional-paths: bin/ameba

  - name: Run tests
    run: crystal spec

Or, if you didn't use something like Ameba and didn't do matrix testing against old Crystal versions, something as simple as:

steps:
  - uses: actions/[email protected]

  - uses: crystal-lang/install-crystal@v1
    with:
      crystal: latest
      shards-cache: true

  - name: Run tests
    run: crystal spec

crystal nightly + shards nightly is broken on Windows

Example CI run: https://github.com/crystal-lang/install-crystal/actions/runs/4453968253/jobs/7822837689#step:4:27

This has been broken for a couple of months apparently.

The action seems to be trying to build shards on Windows which fails.

make
mkdir -p lib/molinillo
shards install || (curl -L "https://github.com/crystal-lang/crystal-molinillo/archive/v   Creating library C:\Users\runneradmin\AppData\Local\crystal\cache\crystal-run-eval.tmp.lib and object C:\Users\runneradmin\AppData\Local\crystal\cache\crystal-run-eval.tmp.exp 0.2.0.tar.gz" | tar -xzf - -C lib/molinillo --strip-components=1)

---
Error: Error: Command failed: make
File not found - *.cr
/usr/bin/bash: line 1: shards: command not found
curl: (3) URL using bad/illegal format or missing URL

Problems with scheduled builds?

The configurator suggests scheduled builds for libraries, and a lot of shards seems to be doing this.

But it seems that GitHub might have a bug in the scheduler handling. I got the suspicion on naqvis/crystal-vips and after a lot of digging through repos trying to find someone with the same prerequisites, I found hugopl/pango.cr which exhibit the same symptoms.

It seems that if GitHub disables the scheduled workflow due to repository inactivity, it doesn't just disable the scheduled run of the workflow, but the entire workflow, on push, pull_request, the works.

The scheduled workflow on crystal-vips was disabled last month. Looking at the history, the fixed memory usage issue from ten months ago ran both workflows in the repository, but the Merge pull request #6 from two weeks ago only ran one.

Similarly, the workflow on pango.cr was disabled 7 months ago, and the Release v0.2.0. commit from last year ran it, while the Release v0.3.0. from 5 months ago, didn't run anything.

This isn't a problem for some ecosystems where code churn is high, but it is for Crystal, where code has a longer shelf life. And it seems that it's an issue likely to be missed by the maintainers (actions failing to run is very easy to overlook).

I've created a ticket at https://support.github.com/contact/bug-report, but I fear it might be by design, so install-crystal might want to take this into consideration.

Missing SSL on Mac OSX

Using this github action to install crystal on latest OSX is yielding
ld: library not found for -lssl (this usually means you need to install the development package for libssl) error, when crystal code depending on openssl.

Operating System

  Mac OS X
  10.15.7
  19H15

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/deploy-docs.yml
  • actions/checkout v4
  • actions/setup-python v5
  • actions/upload-pages-artifact v3
  • actions/deploy-pages v4
.github/workflows/main.yml
  • actions/checkout v4
  • actions/checkout v4
.github/workflows/release.yml
  • actions/checkout v4
  • crystal-lang/install-crystal v1
npm
package.json
  • @actions/cache ^3.2.2
  • @actions/core ^1.10.1
  • @actions/glob ^0.4.0
  • @actions/io ^1.1.3
  • @actions/tool-cache ^2.0.1
  • @octokit/rest ^20.0.2
  • node-fetch ^3.3.2
  • tag-cmp ^1.0.1
  • eslint ^8.51.0

  • Check this box to trigger a request for Renovate to run again on this repository

Warning: The `set-output` command is deprecated

We've been recently getting the following message in our CI:

Warning: The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

It happens after every step of the Run crystal-lang/[email protected] action (looking at the changelog shows that 1.7.0 didn't fix the problem).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.