summaryrefslogtreecommitdiff
path: root/.github/actions/setup/ubuntu/action.yml
blob: a9e5b4195198187e912c15c399f4a531cb68535c (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
name: Setup ubuntu environment
description: >-
  At the beginning there was no way but to copy & paste `apt-get`
  everywhere.  But now that we have composite actions, it seems better
  merge them into one.

inputs:
  arch:
    required: false
    default: ''
    description: >-
      Architecture.  Because we run this on a GitHub-hosted runner
      acceptable value for this input is very limited.

outputs:
  arch:
    value: ${{ steps.uname.outputs.uname }}
    description: >-
      Actual architecture.  This could be different from the one
      passed to the `inputs.arch`.  For instance giving `i386` to this
      action yields `i686`.

runs:
  using: composite

  steps:
    - name: set SETARCH
      shell: bash
      run: echo "SETARCH=${setarch}" >> "$GITHUB_ENV"
      env:
        setarch: ${{ inputs.arch && format('setarch {0} --', inputs.arch) }}

    - id: uname
      name: uname
      shell: bash
      run: |
        echo uname=`${SETARCH} uname -m` >> "$GITHUB_OUTPUT"
        echo dpkg=`${SETARCH} uname -m | sed s/686/386/` >> "$GITHUB_OUTPUT"

    - name: apt-get
      shell: bash
      env:
        arch: ${{ inputs.arch && format(':{0}', steps.uname.outputs.dpkg) || '' }}
      run: |
        set -x
        ${arch:+sudo dpkg --add-architecture ${arch#:}}
        sudo apt-get update -qq || :
        sudo apt-get install --no-install-recommends -qq -y -o=Dpkg::Use-Pty=0 \
        ${arch:+cross}build-essential${arch/:/-} \
        libssl-dev${arch} libyaml-dev${arch} libreadline6-dev${arch} \
        zlib1g-dev${arch} libncurses5-dev${arch} libffi-dev${arch} \
        autoconf ruby
        sudo apt-get install -qq -y pkg-config${arch} || :