-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
action.yml
48 lines (46 loc) · 1.73 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
---
name: Setup COBOL
author: Yevhen Fabizhevskyi
description: This action sets up GnuCOBOL.
branding:
icon: chevrons-right
color: gray-dark
inputs:
version:
description: "GnuCOBOL version."
required: false
default: "3.1.2"
runs:
using: "composite"
steps:
- name: Fail
if: ${{ runner.os != 'Linux' }}
shell: sh
run: |
echo "::error::${RUNNER_OS} ${RUNNER_ARCH} is not supported"
exit 1
- name: Collect info
id: info
shell: sh
run: |
cobol_installed=$(if command -v cobc >/dev/null 2>&1; then echo true; else echo false; fi)
echo "cobol-installed=${cobol_installed}" >> "$GITHUB_OUTPUT"
mkdir -p "${GITHUB_WORKSPACE}/cobol"
echo "cobol-path=${GITHUB_WORKSPACE}/cobol" >> "$GITHUB_OUTPUT"
- name: Install COBOL
if: ${{ steps.info.outputs.cobol-installed == 'false' }}
env:
INPUT_VERSION: "${{ inputs.version }}"
shell: sh
run: |
sudo apt-get update
sudo apt-get -y install curl tar libncurses5-dev libgmp-dev libdb-dev
sudo apt-get -y autoremove
sudo apt-get -y install iproute2
# download and install open-cobol for dependencies (libcob >= 4.0)
sudo apt-get -y install ranger autoconf build-essential
curl -sLk https://sourceforge.net/projects/open-cobol/files/gnu-cobol/"$(echo "${INPUT_VERSION}" | cut -b1- | cut -b-3)"/gnucobol-"${INPUT_VERSION}".tar.gz | tar xz
cd gnucobol-"${INPUT_VERSION}" && ./configure --prefix=/usr && sudo make && sudo make install && sudo ldconfig && cd /tmp/ && sudo rm -rf ./*
sudo apt-get -y --purge autoremove
echo "/home/cobol" >> "$GITHUB_PATH"
working-directory: ${{ steps.info.outputs.cobol-path }}