-
Notifications
You must be signed in to change notification settings - Fork 0
Add action for slic configuration #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2df7b50
Add action for slic configuration
shvlv ff845b7
Update slic workflow example
shvlv 29992bc
Use pup build for slic workflow example
shvlv 13a61e7
Add additional inputs for configure-slic action
shvlv a26d6d1
Improve configure-slic documentation
shvlv 0cb80c7
Fix configure-slic documentation spelling
shvlv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Configure slic | ||
|
|
||
| The composite action prepares the environment for running the tests with [slic](https://github.com/stellarwp/slic). | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Required | Default | Description | | ||
| |--------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | `slic_ref` | no | 'main' | Git reference to checkout slic repository. It might be needed for debug or testing purposes. | | ||
| | `php_version` | no | '' | If it's not provided the [default slic PHP version](https://github.com/stellarwp/slic/blob/f89dbeaa7af9b795ede5d43be0fea3f8d929fd4a/.env.slic#L50) will be used. Only single dot notation is supported (e.g. 8.1, not 8.1.31). Note the [WordPress Supported Version Charts](https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/#supported-version-chart) to provide a valid `php_version` and `wp_version` combination. | | ||
| | `composer_version` | no | '' | If it's not provided the [default slic Composer version](https://github.com/stellarwp/slic/blob/1bdf39f39a57f2228a80a7870880fbdaec53a66d/src/commands/composer.php#L48) will be used. 1 or 2 options can be passed. | | ||
| | `wp_version` | no | '' | If it's not provided the [default slic WordPress version](https://github.com/stellarwp/slic/blob/7e79022ce53adfcad514f09528fcb2d204b9e77b/.github/workflows/publish-wordpress-docker-image.yml#L19) will be used. Any value supported by the `wp core update` `--version` argument can be passed. | | ||
| | `airplane_mode` | no | 'on' | If airplane mode is enabled no external files are loaded or HTTP requests are performed. To disable airplane mode pass `off`. | | ||
|
|
||
|
|
||
| ## Workflow example | ||
|
|
||
| ```yaml | ||
| name: Automated Testing | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| tests: | ||
| name: Tests | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| PHP_VERSION: '7.4' | ||
| steps: | ||
| - name: Clone repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Configure slic | ||
| uses: stellarwp/github-actions/configure-slic@main | ||
| with: | ||
| wp_version: 6.7 | ||
shvlv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| php_version: ${{ env.PHP_VERSION }} | ||
|
|
||
| - name: Use package | ||
| run: | | ||
| ${SLIC_BIN} use ${{ github.event.repository.name }} | ||
|
|
||
| - name: Configure php | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ env.PHP_VERSION }} | ||
| coverage: none | ||
| tools: stellarwp/pup | ||
|
|
||
| - name: Configure Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'npm' | ||
|
|
||
| - name: Build | ||
| run: | | ||
| pup build --dev | ||
|
|
||
| - name: Run tests | ||
| run: ${SLIC_BIN} run --ext DotReporter | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: ${{ failure() }} | ||
| with: | ||
| name: Tests failure output | ||
| path: ./tests/_output/** | ||
| if-no-files-found: ignore | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Configure slic | ||
| description: Installs and configures slic | ||
|
|
||
| inputs: | ||
| slic_ref: | ||
| required: false | ||
| default: 'main' | ||
| description: Reference to checkout stellarwp/slic repository | ||
| php_version: | ||
| required: false | ||
| default: '' | ||
| description: PHP version run in the container | ||
| composer_version: | ||
| required: false | ||
| default: '' | ||
| description: Composer version to be used | ||
| wp_version: | ||
| required: false | ||
| default: '' | ||
| description: WordPress version to be installed | ||
| airplane_mode: | ||
| required: false | ||
| default: 'on' | ||
| description: Airplane mode, no external connections (on/off) | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Checkout slic | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: stellarwp/slic | ||
| ref: ${{ inputs.slic_ref }} | ||
| path: slic | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Set up slic env vars | ||
| shell: bash | ||
| run: | | ||
| echo "SLIC_BIN=${GITHUB_WORKSPACE}/slic/slic" >> $GITHUB_ENV | ||
| echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV | ||
| echo "SLIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV | ||
|
|
||
| - name: Set run context for slic | ||
| shell: bash | ||
| run: echo "SLIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV | ||
|
|
||
| - name: Start ssh-agent | ||
| shell: bash | ||
| run: | | ||
| mkdir -p "${HOME}/.ssh"; | ||
| ssh-agent -a /tmp/ssh_agent.sock; | ||
|
|
||
| - name: Export SSH_AUTH_SOCK env var | ||
| shell: bash | ||
| run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV | ||
|
|
||
| - name: Set up slic for CI | ||
| shell: bash | ||
| run: | | ||
| cd ${GITHUB_WORKSPACE}/.. | ||
| ${SLIC_BIN} here | ||
| ${SLIC_BIN} interactive off | ||
| ${SLIC_BIN} build-prompt off | ||
| ${SLIC_BIN} build-subdir off | ||
| ${SLIC_BIN} xdebug off | ||
| ${SLIC_BIN} debug on | ||
shvlv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ${SLIC_BIN} info | ||
| ${SLIC_BIN} config | ||
shvlv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Configure PHP version | ||
| if: ${{ inputs.php_version != '' }} | ||
| shell: bash | ||
| run: | | ||
| ${SLIC_BIN} php-version set ${{ inputs.php_version }} --skip-rebuild | ||
|
|
||
| - name: Configure Composer version | ||
| if: ${{ inputs.composer_version != '' }} | ||
| shell: bash | ||
| run: | | ||
| ${SLIC_BIN} composer set-version ${{ inputs.composer_version }} | ||
|
|
||
| - name: Update WordPress version | ||
| if: ${{ inputs.wp_version != '' }} | ||
| shell: bash | ||
| run: | | ||
| ${SLIC_BIN} wp core update --version=${{ inputs.wp_version }} --force | ||
shvlv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ${SLIC_BIN} wp core update-db | ||
| ${SLIC_BIN} wp core version | ||
|
|
||
| - name: Enable airplane mode | ||
| if: ${{ inputs.airplane_mode == 'on' }} | ||
| shell: bash | ||
| run: | | ||
| ${SLIC_BIN} airplane-mode on | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.