Skip to content

Commit

Permalink
feat: convert to a composite action
Browse files Browse the repository at this point in the history
This also adds the following features:

- Use `--prefer-stable` with lowest dependencies (#178)
- Allow use of a custom cache key (#167)
- Allow ability to ignore the cache

Fixes: #187, #161, #152, #79
  • Loading branch information
ramsey committed Dec 23, 2021
1 parent 994bb19 commit 46466bf
Show file tree
Hide file tree
Showing 100 changed files with 991 additions and 259,417 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Expand Up @@ -7,6 +7,10 @@ root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.{yml,yaml}]
indent_size = 2
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

54 changes: 0 additions & 54 deletions .eslintrc.json

This file was deleted.

13 changes: 12 additions & 1 deletion .gitattributes
@@ -1 +1,12 @@
dist/** -diff linguist-generated=true
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/CHANGELOG.md export-ignore
/CODE_OF_CONDUCT.md export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/CONTRIBUTING.md export-ignore
/SECURITY.md export-ignore
/subdirectory/ export-ignore
/tests/ export-ignore
8 changes: 0 additions & 8 deletions .github/dependabot.yml

This file was deleted.

63 changes: 41 additions & 22 deletions .github/workflows/continuous-integration.yml
@@ -1,29 +1,31 @@
name: "CI"
# GitHub Actions Documentation: https://docs.github.com/en/actions

on:
pull_request:
push:
branches:
- "v[0-9]+"
name: "build"

jobs:
on: ["pull_request", "push"]

# Make sure build/ci work properly.
build:
name: "Build"
jobs:
test:
name: "Expect Tests"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "shivammathur/setup-php@v2"
- name: "Checkout repository"
uses: "actions/checkout@v2"
- name: "Install expect"
run: |
sudo apt-get update
sudo apt-get -y install expect
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
- run: "npm install"
- run: "npm run all"
- uses: "codecov/codecov-action@v1"
tools: "composer:v2"
coverage: "none"
- name: "Run expect tests"
run: "composer test"

# Make sure the action works on a clean machine without building.
test:
name: "Test"
run:
name: "Run Action"
runs-on: "${{ matrix.operating-system }}"
strategy:
matrix:
Expand All @@ -35,14 +37,31 @@ jobs:
- "highest"
- "locked"
composer-options:
- "--working-dir subdirectory"
- "--ignore-platform-reqs"
- ""
working-directory:
- "subdirectory"
- ""
ignore-cache:
- "yes"
- ""
custom-cache-key:
- "my-super-custom-cache-key"
- ""
steps:
- uses: "actions/checkout@v2"
- uses: "shivammathur/setup-php@v2"
- name: "Checkout repository"
uses: "actions/checkout@v2"
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
- uses: ./
tools: "composer:v2"
coverage: "none"
- name: "Run composer-install action"
uses: ./
with:
dependency-versions: "${{ matrix.dependency-versions }}"
composer-options: "${{ matrix.composer-options }}"
working-directory: "${{ matrix.working-directory }}"
ignore-cache: "${{ matrix.ignore-cache }}"
custom-cache-key: "${{ matrix.custom-cache-key }}"
103 changes: 2 additions & 101 deletions .gitignore
@@ -1,101 +1,2 @@
# Dependency directory
node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*

vendor/
**/vendor/
/tests/expect/**.txt
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

10 changes: 0 additions & 10 deletions .prettierrc.json

This file was deleted.

27 changes: 21 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -68,17 +68,32 @@ When you do begin working on your feature, here are some guidelines to consider:

## Running Tests

The following must pass before we will accept a pull request. If this does not
pass, it will result in a complete build failure. Before you can run this, be
sure to `npm install`.
This project includes a suite of tests located in `tests/expect/`.
These tests use the [Expect](https://en.wikipedia.org/wiki/Expect) tool to
automate CLI interactions. The tests will run automatically as part of
continuous integration, or you may run them locally with:

To run all the tests and coding standards checks, execute the following from the
command line, while in the project root directory:
```
composer test
```

To run the tests, you must have an up-to-date version of coreutils (8.30 or
later).

To generate a new test:

```
npm run all
cd tests/expect/
autoexpect ../../bin/path-to-script-to-test.sh
```

`autoexpect` will save the test to `script.exp`. Rename it with a more
descriptive name, and run it to ensure it does what you expect: `./script.exp`.
You may need to edit the test file or add to it, according to your needs.

When done, `cd ../..` and run `composer test`.
Your new test should run along with the other tests.

[github]: https://github.com/ramsey/composer-install
[issues]: https://github.com/ramsey/composer-install/issues
[pull requests]: https://github.com/ramsey/composer-install/pulls
Expand Down

0 comments on commit 46466bf

Please sign in to comment.