Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Sep 28, 2024
1 parent 9459d80 commit e191ce4
Show file tree
Hide file tree
Showing 13 changed files with 874 additions and 159 deletions.
102 changes: 87 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
- github-actions
- ci
- develop
pull_request:
branches:
- master
Expand All @@ -17,10 +18,10 @@ jobs:
fail-fast: false
matrix:
PHP_VERSION:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
COVERAGE: ["true", "false"]
steps:
- uses: actions/checkout@v3
Expand All @@ -44,10 +45,10 @@ jobs:
fail-fast: false
matrix:
PHP_VERSION:
- "7.4"
- "8.0"
- "8.1"
- "8.2-rc"
- "8.2"
- "8.3"
- "8.4.0RC1"
DOCKER_NAME:
- "alpine"
- "debian"
Expand All @@ -64,7 +65,7 @@ jobs:
docker-fedora:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I am putting everything in a FSCKING BASH SCRIPT
env:
DOCKER_NAME: fedora
Expand All @@ -77,9 +78,9 @@ jobs:
fail-fast: false
matrix:
PHP_VERSION:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -89,12 +90,83 @@ jobs:
PHP_VERSION: ${{ matrix.PHP_VERSION }}
run: bash ./.github/scripts/osx.sh

nix:

nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-24.05
extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm"
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix:
name: "nix (${{ matrix.name }})"
runs-on: ${{ matrix.os }}
needs: nix-matrix
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-22.05
- run: nix-build
- run: nix-build nix/ci.nix
- uses: actions/checkout@v4

- name: Set Up Build Cache
uses: actions/cache@v4
id: nix-cache
with:
path: /tmp/nix-store.nar
key: nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.attr }}
restore-keys: |
nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.attr }}
nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-
nix-store.nar-${{ runner.os }}-
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-24.05
extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm"

- name: Import Nix Store Cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: |
nix-store --import < /tmp/nix-store.nar
- run: nix build -L ".#${{ matrix.attr }}"

- run: find -L result*; cp result-coverage/coverage.info coverage.info || true

# - name: Upload coverage reports to Codecov
# if: ${{ hashFiles('coverage.info') != '' }}
# uses: codecov/codecov-action@v4
# with:
# file: coverage.info
# token: ${{ secrets.CODECOV_TOKEN }}
# slug: jbboehr/php-perfifidous
#
# - name: Coveralls
# if: ${{ hashFiles('coverage.info') != '' }}
# uses: coverallsapp/github-action@v2
# continue-on-error: true
# with:
# file: coverage.info
# format: lcov
# parallel: true

- name: Export Nix Store Cache
shell: bash
# partially based on https://github.com/NixOS/nix/issues/1245#issuecomment-282586759
run: |
drv="$(nix-store -qd "$(readlink result)")"
drvRefs="$( echo "$drv" | xargs nix-store -q --references )"
( echo "$drvRefs" | grep '[.]drv$' | xargs nix-store -q --outputs ;
echo "$drvRefs" | grep -v '[.]drv$' ) | \
xargs nix-store -r | \
xargs nix-store -qR |
xargs nix-store --export > /tmp/nix-store.nar
27 changes: 20 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ acinclude.m4
aclocal.m4
autom4te.cache
build
.c9
cmake-build-debug
CMakeLists.txt
config.guess
Expand All @@ -17,37 +18,49 @@ configure
configure.ac
configure.in
coverage.info
*.dep
.deps
.direnv
.dirstamp
gmon*
.idea
*.img
install-sh
*.la
.libs
libtool
*.lo
*.log
ltmain.sh
ltmain.sh.backup
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
*.mem
*.mem.core.*
missing
mkinstalldirs
modules
nbproject
*.o
*.out
.php-version
.pre-commit-config.yaml
.*project
*.qcow2
run-tests.php
.settings
specs
test_coverage
*-*.*.*.tgz
test_coverage/
test.php
tests/*.diff
tests/*.exp
tests/*.php
tests/*.sh
tests/**/*.diff
tests/**/*.exp
tests/**/*.php
tests/**/*.sh
third-party
tmp-php.ini

vgcore.*
/result*

/vendor/
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,99 @@ All Notable changes to `php-mustache` will be documented in this file.

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [Unreleased]

## [0.9.3] - 2022-11-26

### Fixed

- PHP 8.2 compat (@remicollet)

## [0.9.2] - 2020-11-12

### Fixed

- Fixes for latest PHP 8.0

### Changed

- Drop max PHP version constraint in package.xml

## [0.9.1] - 2019-12-11

### Fixed

- Memory leak ([GH-57](https://github.com/jbboehr/php-mustache/issues/57))
- PHP 7.4 build issues ([GH-61](https://github.com/jbboehr/php-mustache/pull/61)) ([@sunpoet](https://github.com/sunpoet))

## [0.9.0] - 2019-05-27

### Added

- Preliminary PHP 7.4 and PHP 8 support

### Removed

- PHP 5 support, require at least PHP 7.1

## [0.8.1] - 2019-05-27

### Fixed

- Missing file in PECL distribution (@remicollet)

## [0.8.0] - 2018-11-11

### Added

- PHP 7.3 support (@remicollet)

### Changed

- Require libmustache >= 0.5.0 (fixes a double-free)

### Removed

- Old deprecated experimental compiler
- Support for less than PHP 5.6

## [0.7.4] - 2017-07-18

### Added

- PHP 7.2 support (@remicollet)

### Fixed

- RHEL/CentOS build issues (@remicollet)

## [0.7.3] - 2017-07-18

### Added

- PHP 7.1 support (@adambaratz and @remicollet)

### Fixed

- RHEL/CentOS build issues (@amcnea)

## [0.7.2] - 2016-04-24

### Fixed

- Indirect zval issues (@adambaratz)

## [0.7.1] - 2016-03-17

### Fixed

- Various lambda issues (@adambaratz)

## [0.7.0] - 2016-03-17

### Added
- Lambda support (@adambaratz)

- Lambda support (@adambaratz)

[Unreleased]: https://github.com/jbboehr/php-mustache/compare/v0.9.3...HEAD
[0.9.3]: https://github.com/jbboehr/php-mustache/compare/v0.9.2...v0.9.3
Expand All @@ -92,4 +110,3 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
[0.7.2]: https://github.com/jbboehr/php-mustache/compare/v0.7.1...v0.7.2
[0.7.1]: https://github.com/jbboehr/php-mustache/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/jbboehr/php-mustache/compare/v0.6.1...v0.7.0

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright (c) 2012 John Boehr <jbboehr@gmail.com>
Copyright (c) anno Domini nostri Jesu Christi MMXII-MMXXIV John Boehr & contributors

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@

C++ implementation of [Mustache](http://mustache.github.com/) as a PHP extension.


## Features

All features of Mustache are supported EXCEPT:

* Whitespace rules. All whitespace is kept as it is in the input template.


## Installation

### Linux/OSX
Expand Down Expand Up @@ -72,7 +70,6 @@ nix-env -i -f https://github.com/jbboehr/php-mustache/archive/master.tar.gz

See [Build your own PHP on Windows](https://wiki.php.net/internals/windows/stepbystepbuild). You may need to add [msinttypes](https://code.google.com/p/msinttypes/) ([export](https://github.com/jbboehr/msinttypes/)) to your include directory.


## Usage

Example:
Expand Down Expand Up @@ -111,10 +108,9 @@ See also: [template loader example](examples.md)

## Credits

- [John Boehr](https://github.com/jbboehr)
- [Adam Baratz](https://github.com/adambaratz)
- [All Contributors](../../contributors)

* [John Boehr](https://github.com/jbboehr)
* [Adam Baratz](https://github.com/adambaratz)
* [All Contributors](../../contributors)

## License

Expand Down
11 changes: 9 additions & 2 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ PHP_ARG_ENABLE(mustache, whether to enable mustache support,
dnl Make sure that the comment is aligned:
[ --enable-mustache Enable mustache support])

PHP_ARG_ENABLE(mustache-coverage, whether to enable mustache coverage support,
[AS_HELP_STRING([--enable-mustache-coverage], [Enable mustache coverage support])], [no], [no])

dnl LIBMUSTACHE ----------------------------------------------------------------
PHP_ARG_WITH(libmustache, libmustache location,
dnl Make sure that the comment is aligned:
Expand Down Expand Up @@ -61,12 +64,16 @@ fi

dnl MAIN -----------------------------------------------------------------------
if test "$PHP_MUSTACHE" != "no"; then
AH_BOTTOM([
AH_BOTTOM([
#ifdef __clang__
#include "main/php_config.h"
#/**/undef/**/ HAVE_ASM_GOTO
#endif
])
])
if test "$PHP_MUSTACHE_COVERAGE" == "yes"; then
CXXFLAGS="--coverage -fprofile-arcs -ftest-coverage $CXXFLAGS"
LDFLAGS="--coverage -lgcov $LDFLAGS"
fi

AC_DEFINE(HAVE_MUSTACHE, 1, [Whether you have mustache support])
PHP_REQUIRE_CXX()
Expand Down
Loading

0 comments on commit e191ce4

Please sign in to comment.