npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cache-extensions

v1.10.1

Published

Cache PHP extensions in GitHub Actions

Downloads

15

Readme

Cache PHP extensions in GitHub Actions. This action has to be used along with shivammathur/setup-php and actions/cache GitHub Actions. It configures the environment required to cache PHP extensions. Refer to Usage section for details and example workflow.

Contents

:tada: PHP Support

|PHP Version|Stability|Release Support| |--- |--- |--- | |5.3|Stable|End of life| |5.4|Stable|End of life| |5.5|Stable|End of life| |5.6|Stable|End of life| |7.0|Stable|End of life| |7.1|Stable|End of life| |7.2|Stable|End of life| |7.3|Stable|End of life| |7.4|Stable|End of life| |8.0|Stable|End of life| |8.1|Stable|Security fixes only| |8.2|Stable|Active| |8.3|Stable|Active| |8.4|Nightly|In development|

:cloud: OS/Platform Support

| Virtual environment | YAML workflow label | |---------------------|------------------------------------| | Ubuntu 22.04 | ubuntu-latest or ubuntu-22.04 | | Ubuntu 20.04 | ubuntu-20.04 | | Windows Server 2022 | windows-latest or windows-2022 | | Windows Server 2019 | windows-2019 | | macOS Ventura 13.x | macos-13 | | macOS Monterey 12.x | macos-latest or macos-12 |

:memo: Usage

Use this GitHub Action when the extensions you are adding in setup-php are installed and take a long time to set up. If you are using extensions which have the result Installed and enabled in the logs like pecl extensions on Ubuntu or extensions which have custom support, it is recommended to use this action to cache your extensions.

Inputs

php-version (optional)

  • Specify the PHP version you want to set up.
  • Accepts a string. For example '8.0'.
  • Accepts latest to set up the latest stable PHP version.
  • Accepts nightly to set up a nightly build from the master branch of PHP.
  • Accepts the format d.x, where d is the major version. For example 5.x, 7.x and 8.x.
  • See PHP support for the supported PHP versions.
  • If not specified, it looks for php-version-file input.

php-version-file (optional)

  • Specify a file with the PHP version you want to set up.
  • Accepts a string. For example '.phpenv-version'.
  • See PHP support for the supported PHP versions.
  • By default, .php-version file is used.
  • If not specified and the default .php-version file is not found, the latest stable PHP version is set up.

extensions (required)

  • Specify the extensions you want to set up.
  • Accepts a string in csv-format. For example mbstring, xdebug, :opcache.
  • Extensions prefixed with : are ignored in output cache key.

key (required)

  • Specify the key to identify the cache version.
  • Accepts any string. For example cache-v1.
  • Changing this would reset the cache.

See action.yml and usage below for more info.

Workflow

Cache extensions in a PHP workflow

jobs:
  run:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        operating-system: [ubuntu-latest, windows-latest, macos-latest]
        php-versions: ['8.1', '8.2', '8.3']
    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
    env:
      extensions: intl, pcov
      key: cache-v1 # can be any string, change to clear the extension cache.
    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Setup cache environment
      id: extcache
      uses: shivammathur/cache-extensions@v1
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: ${{ env.extensions }}
        key: ${{ env.key }}

    - name: Cache extensions
      uses: actions/cache@v3
      with:
        path: ${{ steps.extcache.outputs.dir }}
        key: ${{ steps.extcache.outputs.key }}
        restore-keys: ${{ steps.extcache.outputs.key }}

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: ${{ env.extensions }}

Thread Safe Setup

If you set up both TS and NTS PHP versions in your workflow, please add ${{ env.phpts }} to key and restore-keys inputs in actions/cache step in the above workflow to avoid a conflicting cache.

- name: Cache extensions
  uses: actions/cache@v3
  with:
    path: ${{ steps.extcache.outputs.dir }}
    key: ${{ steps.extcache.outputs.key }}-${{ env.phpts }}
    restore-keys: ${{ steps.extcache.outputs.key }}-${{ env.phpts }}

:scroll: License

The code and documentation in this project are under the MIT License. This project has multiple dependencies. Their licenses can be found in their respective repositories.

:+1: Contributions

Contributions are welcome! See Contributor's Guide. If you face any issues while using this or want to suggest a feature/improvement, create an issue here.

:sparkling_heart: Support This Project

If this action helped you.

  • Please star the project and share it. If you blog, please share your experience of using this action.
  • Please support our work by sponsoring using GitHub sponsors.

:package: Dependencies