Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
* text=auto
*.bat eol=crlf

/.github/ export-ignore
/test export-ignore
/spec export-ignore

# Remove all dot files for export
.editorconfig export-ignore
.php_cs export-ignore
.travis.yml export-ignore


phpcs.xml export-ignore
phpspec.yml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpcs.xml export-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
# https://getcomposer.org/doc/03-cli.md#composer-cache-dir

name: "Determine composer cache directory"

description: "Determines the composer cache directory and exports it as COMPOSER_CACHE_DIR environment variable"

runs:
using: "composite"

steps:
- name: "Determine composer cache directory"
shell: "bash"
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
22 changes: 22 additions & 0 deletions .github/actions/composer/composer/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions

name: "Install dependencies with composer"

description: "Installs dependencies with composer"

inputs:
dependencies:
description: "Which dependencies to install, one of \"lowest\", \"locked\", \"highest\""
required: true

runs:
using: "composite"

steps:
- name: "Install ${{ inputs.dependencies }} dependencies with composer"
shell: "bash"
run: "${{ github.action_path }}/run.sh"
env:
COMPOSER_INSTALL_DEPENDENCIES: "${{ inputs.dependencies }}"
25 changes: 25 additions & 0 deletions .github/actions/composer/composer/install/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

dependencies="${COMPOSER_INSTALL_DEPENDENCIES}"

if [[ ${dependencies} == "lowest" ]]; then
composer update --no-interaction --no-progress --prefer-lowest

exit $?
fi

if [[ ${dependencies} == "locked" ]]; then
composer install --no-interaction --no-progress

exit $?
fi

if [[ ${dependencies} == "highest" ]]; then
composer update --no-interaction --no-progress

exit $?
fi

echo "::error::The value for the \"dependencies\" input needs to be one of \"lowest\", \"locked\"', \"highest\"' - got \"${dependencies}\" instead."

exit 1
46 changes: 41 additions & 5 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,50 @@ on: # yamllint disable-line rule:truthy
pull_request: null
push:
branches:
- "main"
- "master"

jobs:
hello:
name: "Hello"
coding-standards:
name: "Coding Standards"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "5.4"

dependencies:
- "locked"

steps:
- name: "Say hello"
run: "echo 'Hello!'"
- name: "Checkout"
uses: "actions/checkout@v2.3.3"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@2.7.0"
with:
coverage: "none"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

- name: "Validate composer.json and composer.lock"
run: "composer validate --strict"

- name: "Determine composer cache directory"
uses: "./.github/actions/composer/composer/determine-cache-directory"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2.1.2"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "./.github/actions/composer/composer/install"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run squizlabs/php_codesniffer"
run: "vendor/bin/phpcbf"
38 changes: 3 additions & 35 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
# All dot (e.g. .htaccess) files #
#######################
.*
.*/*

# OS generated files #
######################
thumbs.db
Icon
Thumbs.db
tags
vendor.tags
tmtagsHistory


# IDE generated files #
#######################
.project
*.sublime-project
*.sublime-workspace
atlassian-ide-plugin.xml

# PHP-specific files #
#######################
/vendor/*
/bin/*
/data/*
/build/*
composer.phar

# Dot files we want to keep #
#######################
!/.git*
!/.php_cs
!/.editorconfig
/.build/
/.notes/
/vendor/
34 changes: 0 additions & 34 deletions .php_cs

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Teapot: Status Codes

[![Integrate](https://github.com/teapot-php/status-code/workflows/Integrate/badge.svg?branch=master)](https://github.com/teapot-php/status-code/actions)
[![latest_stable_version_img]][latest_stable_version]
[![latest_unstable_version_img]][latest_unstable_version]
[![license_img]][license]
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"exclude": [
"/*, !/src"
]
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5.8"
}
}
61 changes: 59 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<file>src/</file>

<rule ref="PSR2"/>
</ruleset>
1 change: 0 additions & 1 deletion src/Vendor/RFC7238.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Teapot\StatusCode\Vendor;


class RFC7238
{

Expand Down