From 506357cdb9f33326136afc333798fb186a86fdea Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 2 Aug 2021 22:55:00 +0530 Subject: [PATCH] Sunset support for Ubuntu 16.04 --- .github/workflows/main-workflow.yml | 2 +- README.md | 1 - dist/index.js | 7 ++++--- src/install.ts | 11 ++++++----- src/scripts/linux.sh | 10 +--------- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main-workflow.yml b/.github/workflows/main-workflow.yml index b303dd2a8..970da7c16 100644 --- a/.github/workflows/main-workflow.yml +++ b/.github/workflows/main-workflow.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-latest, macos-latest] + operating-system: [ubuntu-20.04, ubuntu-18.04, windows-latest, macos-latest] php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] steps: - name: Checkout diff --git a/README.md b/README.md index 6110ac17e..19f3628a7 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,6 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support |Virtual environment|YAML workflow label|Pre-installed PHP| |--- |--- |--- | -|Ubuntu 16.04 [(deprecated)](https://setup-php.com/i/452)|`ubuntu-16.04`|`PHP 5.6` to `PHP 8.0`| |Ubuntu 18.04|`ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`| |Ubuntu 20.04|`ubuntu-latest` or `ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`| |Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`| diff --git a/dist/index.js b/dist/index.js index ade488977..bfffefe15 100644 --- a/dist/index.js +++ b/dist/index.js @@ -438,15 +438,16 @@ async function build(filename, version, os_version) { exports.build = build; async function run() { try { + if ((await utils.readEnv('ImageOS')) == 'ubuntu16') { + core.setFailed('setup-php is not supported on Ubuntu 16.04. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452'); + return; + } core.warning('setup-php v1 is deprecated.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2'); const version = await utils.parseVersion(await utils.getInput('php-version', true)); if (version == '8.1') { core.setFailed('PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2'); return; } - if ((await utils.readEnv('ImageOS')) == 'ubuntu16') { - core.warning('setup-php will stop working on Ubuntu 16.04 from August 1, 2021. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452'); - } if (version) { const os_version = process.platform; let script_path = ''; diff --git a/src/install.ts b/src/install.ts index 91c33f148..ccb542291 100644 --- a/src/install.ts +++ b/src/install.ts @@ -55,6 +55,12 @@ export async function build( */ export async function run(): Promise { try { + if ((await utils.readEnv('ImageOS')) == 'ubuntu16') { + core.setFailed( + 'setup-php is not supported on Ubuntu 16.04. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452' + ); + return; + } core.warning( 'setup-php v1 is deprecated.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2' ); @@ -67,11 +73,6 @@ export async function run(): Promise { ); return; } - if ((await utils.readEnv('ImageOS')) == 'ubuntu16') { - core.warning( - 'setup-php will stop working on Ubuntu 16.04 from August 1, 2021. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452' - ); - } if (version) { const os_version: string = process.platform; // check the os version and run the respective script diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 3ff3d1d85..c011d1d04 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -30,18 +30,10 @@ cleanup_lists() { # Function to add ppa:ondrej/php. add_ppa() { ppa=${1:-ondrej/php} - if [ "$DISTRIB_RELEASE" = "16.04" ] && [ "$ppa" = "ondrej/php" ]; then - LC_ALL=C.UTF-8 sudo apt-add-repository --remove ppa:"$ppa" -y || true - LC_ALL=C.UTF-8 sudo apt-add-repository http://setup-php.com/ondrej/php/ubuntu -y - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 4f4ea0aae5267a6c - elif ! apt-cache policy | grep -q "$ppa"; then + if ! apt-cache policy | grep -q "$ppa"; then cleanup_lists "$(dirname "$ppa")" LC_ALL=C.UTF-8 sudo apt-add-repository ppa:"$ppa" -y fi - - if [ "$DISTRIB_RELEASE" = "16.04" ]; then - sudo "$debconf_fix" apt-get update - fi } # Function to update the package lists.