Components #7870
This file contains 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
name: "Components" | |
on: | |
push: | |
branches: 1.x | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
schedule: | |
# Once per day. https://crontab.guru/#*_0_*_*_* | |
- cron: "* 0 * * *" | |
- cron: "0 12 * * *" | |
env: | |
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} | |
GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha }} | |
GITHUB_RUN_LOG_URL: https://github.com/opendevshop/devshop/actions/runs/${{ github.run_id }} | |
GIT_REF: 1.x | |
jobs: | |
yaml-tasks: | |
name: YamlTasks | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
# Set working directory for entire file. https://github.community/t5/GitHub-Actions/use-working-directory-for-entire-job/td-p/36759 | |
env: | |
working-directory: ./src/DevShop/Component/YamlTasks | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Get Composer Cache Directory | |
working-directory: ${{env.working-directory}} | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Validate composer.json and composer.lock | |
working-directory: ${{env.working-directory}} | |
run: composer validate | |
- name: Install dependencies | |
working-directory: ${{env.working-directory}} | |
run: | | |
composer install --prefer-dist --no-progress --no-suggest | |
- name: Run Yaml Tasks | |
working-directory: ${{env.working-directory}} | |
env: | |
# @TODO: Get environment variable setting to work. | |
# YAML_TASKS_STATUS_URL: https://github.com/${GITHUB_REPOSITORY}/runs/${GITHUB_RUN_ID}?check_suite_focus=true | |
GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
PROVISION_PROCESS_OUTPUT: direct | |
run: | | |
chmod +x yaml-tasks | |
./yaml-tasks --dry-run --ansi -v --hostname=github.com --status-url=${GITHUB_RUN_LOG_URL}#step:7:1 | |
./yaml-tasks --dry-run --tasks-file tests.yml --ansi -v --hostname=github.com --status-url=${GITHUB_RUN_LOG_URL}#step:7:1 | |
power-process: | |
name: PowerProcess | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
# Set working directory for entire file. https://github.community/t5/GitHub-Actions/use-working-directory-for-entire-job/td-p/36759 | |
env: | |
working-directory: ./src/DevShop/Component/PowerProcess | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
# extensions: intl #optional | |
# ini-values: "post_max_size=256M" #optional | |
- name: Check PHP Version | |
run: php -v | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
working-directory: ${{env.working-directory}} | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
working-directory: ${{env.working-directory}} | |
- name: Test Power Process | |
working-directory: ${{env.working-directory}} | |
run: | | |
./run composer install --prefer-dist --no-progress --no-suggest | |
./demo.php | |
github-api-cli: | |
name: GitHubApiCli | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
# Set working directory for entire file. https://github.community/t5/GitHub-Actions/use-working-directory-for-entire-job/td-p/36759 | |
env: | |
working-directory: ./src/DevShop/Component/GitHubApiCli | |
steps: | |
- uses: actions/checkout@v3 | |
# Uncomment this to see deployments in devshop pull requests. | |
# It gets too noisy run builds on the PR's HEAD commits, | |
# with: | |
# ref: ${{ github.event.pull_request.head.ref }} | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
# extensions: intl #optional | |
# ini-values: "post_max_size=256M" #optional | |
- name: Check PHP Version | |
run: php -v | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
working-directory: ${{env.working-directory}} | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
working-directory: ${{env.working-directory}} | |
# - name: Test GitHub Deploy Start | |
# working-directory: ${{env.working-directory}} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
# run: | | |
# ./github deploy:start -n --description="GitHub API CLI tests begun" --environment=${{ matrix.php-versions }}.github.com | |
# ./github deploy:update -n --state=in_progress | |
- name: Test GitHub Cli | |
working-directory: ${{env.working-directory}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
run: | | |
./github whoami | |
# - name: Test GitHub Deploy Success | |
# working-directory: ${{env.working-directory}} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
# run: | | |
# ./github deploy:update -n --state=success | |
GitTraits: | |
name: GitTraits | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
# Set working directory for entire file. https://github.community/t5/GitHub-Actions/use-working-directory-for-entire-job/td-p/36759 | |
env: | |
working-directory: ./src/DevShop/Component/GitTraits | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
# extensions: intl #optional | |
# ini-values: "post_max_size=256M" #optional | |
- name: Check PHP Version | |
run: php -v | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
working-directory: ${{env.working-directory}} | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
working-directory: ${{env.working-directory}} | |
- name: Test | |
working-directory: ${{env.working-directory}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
run: | | |
./Tests/repo-info.php | |
ControlProject: | |
name: ControlProject | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
env: | |
working-directory: ./src/DevShop/Component/ControlProject | |
devmaster-directory: ../../../devmaster | |
steps: | |
# By default, actions/checkout uses the current SHA for the branch it is testing. See on.push.branches: 1.x | |
# https://github.com/opendevshop/devshop/runs/1517209717?check_suite_focus=true#step:2:465 | |
# For Pull Requests, actions/checkout will use a Merge SHA by default. | |
# This code sets ref to the PR head SHA instead, so it matches what developers see. | |
- name: Check Out Sourcecode | |
uses: actions/checkout@v2 | |
if: github.event_name!='pull_request' | |
# Fetch all branches and tags so composer can resolve the version. | |
- name: Check Out Pull Request Sourcecode | |
uses: actions/checkout@v2 | |
if: github.event_name=='pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Prepare Pull Request-only environment | |
if: github.event_name=='pull_request' | |
run: | | |
echo "GIT_REF=${{ github.head_ref }}" >> $GITHUB_ENV | |
git switch --create ${{ github.head_ref }} | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
# extensions: intl #optional | |
# ini-values: "post_max_size=256M" #optional | |
- name: Check PHP Version | |
run: php -v | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
working-directory: ${{env.working-directory}} | |
# If installing without a lockfile, composer suggests using "update" command instead. | |
- name: Install dependencies | |
# Match the command in ./roles/opendevshop.devshop/tasks/main.yml | |
run: | | |
composer config repositories.devmaster path ${GITHUB_WORKSPACE}/devmaster | |
composer require devshop/devmaster:${GIT_REF}-dev | |
composer install --no-dev --no-progress --prefer-source | |
working-directory: ${{env.working-directory}} | |
- name: Test Project Creation | |
working-directory: ./src/DevShop/Component/ | |
run: | | |
composer create-project devshop/control-project:@dev temp --repository='{"type":"path","url":"ControlProject"}' | |
# @TODO: Launch a devshop test container around this devshop-control code. |