summaryrefslogtreecommitdiff
path: root/.github/actions/setup/baseruby/action.yml
blob: 76fe068897a163862f627091652ebf162185d7cc (plain)
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
name: Setup directories etc.
description: >-
  Build baseruby for cross-compiling

inputs:
  srcdir:
    required: true
    default: ${{ github.workspace }}
    description: >-
      Directory of source codes.

  builddir:
    required: false
    default: ${{ github.workspace }}/baseruby
    description: >-
      Where baseruby will be built.

  installdir:
    required: false
    default: install
    description: >-
      The path where the baseruby will be installed to.
      This is relative from the workspace.

outputs:
  ruby:
    value: ${{ steps.build.outputs.installdir }}/bin/ruby
    description: >-
      The path of the executable baseruby.
  dump_ast:
    value: ${{ steps.build.outputs.installdir }}/bin/dump_ast
    description: >-
      The path of the executable dump_ast.

runs:
  using: composite

  steps:
    - name: Build baseruby
      shell: bash
      id: build
      run: |
        case "$installdir" in /*) ;; *) installdir="$PWD/$installdir";; esac
        mkdir "$builddir"
        ln -sr "$srcdir" "$builddir/.src"
        pushd "$builddir"
        .src/configure "--prefix=${installdir}" --disable-install-doc
        CONFIGURE_ARGS=--with-out-ext=-test- make install
        install dump_ast "${installdir}/bin"
        {
          echo "${installdir}/bin/dump_ast"
          echo "${installdir}/.installed.list"
          echo "${installdir}/"
        } >> .installed.list
        cp .installed.list "${installdir}/"
        make distclean
        rm .src
        popd
        rmdir "$builddir"
        {
          echo "installdir=${installdir}"
        } | tee -a "$GITHUB_OUTPUT"
      env:
        srcdir: ${{ inputs.srcdir }}
        builddir: ${{ inputs.builddir }}
        installdir: ${{ inputs.installdir }}

    - name: clean
      uses: gacts/run-and-post-run@598d7a875d5620e0457490555b5e18e46082aa47 # v1.4.4
      with:
        working-directory: ${{ inputs.srcdir }}
        post: |
          ruby tool/rbuninstall.rb "${{ steps.build.outputs.installdir }}/.installed.list" > /dev/null