Skip to content

Commit 290eccc

Browse files
Clean actions. (#497)
1 parent 73eb925 commit 290eccc

9 files changed

Lines changed: 141 additions & 105 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Environment linux
2+
3+
runs:
4+
using: "composite"
5+
6+
steps:
7+
- name: Set environment variable for work package url (pull request) ubuntu.
8+
if: github.event_name == 'pull_request'
9+
shell: bash
10+
run: |
11+
echo "WORK_PACKAGE_URL=https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/" >> $GITHUB_ENV
12+
echo "FULL_BRANCH_NAME=dev-${{ github.head_ref }}" >> $GITHUB_ENV
13+
14+
- name: Set environment variable for work package url (push) ubuntu.
15+
if: github.event_name == 'push'
16+
shell: bash
17+
run: |
18+
echo "WORK_PACKAGE_URL=https://github.com/${{ github.event.repository.owner.login }}/" >> $GITHUB_ENV
19+
echo "FULL_BRANCH_NAME=dev-master" >> $GITHUB_ENV
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Environment windows
2+
3+
runs:
4+
using: "composite"
5+
6+
steps:
7+
- name: Set environment variable for work package url (pull request) windows.
8+
if: github.event_name == 'pull_request'
9+
shell: pwsh
10+
run: |
11+
echo "WORK_PACKAGE_URL=https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/" | Out-File -FilePath $env:GITHUB_ENV -Append
12+
echo "FULL_BRANCH_NAME=dev-${{ github.head_ref }}" | Out-File -FilePath $env:GITHUB_ENV -Append
13+
14+
- name: Set environment variable for work package url (push) windows.
15+
if: github.event_name == 'push'
16+
shell: pwsh
17+
run: |
18+
echo "WORK_PACKAGE_URL=https://github.com/${{ github.event.repository.owner.login }}/" | Out-File -FilePath $env:GITHUB_ENV -Append
19+
echo "FULL_BRANCH_NAME=dev-master" | Out-File -FilePath $env:GITHUB_ENV -Append

.github/actions/subpackage_install/action.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,38 @@ inputs:
1919

2020
runs:
2121
using: "composite"
22+
2223
steps:
23-
- name: db-mysql / Check exist branch.
24+
- name: Check exist branch (pull request).
25+
if: ${{ github.event_name == 'pull_request' }}
2426
shell: bash
2527
run: |
2628
if git ls-remote --heads ${{ inputs.WORK_PACKAGE_URL }}${{ inputs.CURRENT_PACKAGE }} ${{ inputs.BRANCH_NAME }} | grep ${{ inputs.BRANCH_NAME }};
2729
then echo "BRANCH_EXISTS=1" >> $GITHUB_ENV; else echo "BRANCH_EXISTS=0" >> $GITHUB_ENV; fi
2830
29-
- name: db-mysql / Install from fork.
30-
shell: bash
31+
- name: Install from fork and branch exists.
3132
if: ${{ github.event.pull_request.head.repo.fork && env.BRANCH_EXISTS == 1 }}
33+
shell: bash
3234
run: |
3335
composer config repositories.yiisoft/${{ inputs.CURRENT_PACKAGE }} git ${{ inputs.WORK_PACKAGE_URL }}${{ inputs.CURRENT_PACKAGE }}
3436
COMPOSER_ROOT_VERSION=${{ inputs.COMPOSER_ROOT_VERSION }} composer require "yiisoft/${{ inputs.CURRENT_PACKAGE }}:${{ inputs.FULL_BRANCH_NAME }} as ${{ inputs.COMPOSER_ROOT_VERSION }}" --no-interaction --no-progress --optimize-autoloader --ansi
3537
36-
- name: db-mysql / Install from branch.
38+
- name: Install from fork and branch not exists.
39+
if: ${{ github.event.pull_request.head.repo.fork && env.BRANCH_EXISTS == 0 }}
3740
shell: bash
41+
run: composer require yiisoft/${{ inputs.CURRENT_PACKAGE }}:${{ inputs.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
42+
43+
- name: Install from branch and branch exists.
3844
if: ${{ ! github.event.pull_request.head.repo.fork && env.BRANCH_EXISTS == 1 }}
45+
shell: bash
3946
run: composer require yiisoft/${{ inputs.CURRENT_PACKAGE }}:${{ inputs.FULL_BRANCH_NAME }} --no-interaction --no-progress --optimize-autoloader --ansi
4047

41-
- name: db-mysql / Install from master.
42-
shell: bash
48+
- name: Install from master and branch exists.
4349
if: ${{ github.event.pull_request.head.repo.full_name == 'yiisoft/db' && env.BRANCH_EXISTS != 1 }}
50+
shell: bash
4451
run: composer require yiisoft/${{ inputs.CURRENT_PACKAGE }}:${{ inputs.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
52+
53+
- name: Install from branch (push).
54+
if: ${{ github.event_name == 'push' }}
55+
shell: bash
56+
run: composer require yiisoft/${{ inputs.CURRENT_PACKAGE }}:${{ inputs.FULL_BRANCH_NAME }} --no-interaction --no-progress --optimize-autoloader --ansi

.github/workflows/active-record.yml

Lines changed: 34 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
BRANCH_NAME: ${{ github.head_ref }}
31-
FULL_BRANCH_NAME: dev-${{ github.head_ref }}
32-
WORK_PACKAGE: active-record
33-
WORK_PACKAGE_URL: https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/
34-
extensions: pdo, pdo_mysql, pdo_oci, pdo_pgsql, pdo_sqlite, pdo_sqlsrv-5.10.1
30+
EXTENSIONS: pdo, pdo_mysql, pdo_oci, pdo_pgsql, pdo_sqlite, pdo_sqlsrv-5.10.1
3531

3632
runs-on: ${{ matrix.os }}
3733

@@ -87,102 +83,87 @@ jobs:
8783
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3
8884

8985
steps:
90-
- name: Checkout
86+
- name: Checkout.
9187
uses: actions/checkout@v3
9288

93-
- name: Create MS SQL Database
89+
- name: Create MS SQL Database.
9490
run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'
9591

96-
- name: Install PHP with extensions
92+
- name: Install PHP with extensions.
9793
uses: shivammathur/setup-php@v2
9894
with:
9995
php-version: ${{ matrix.php }}
100-
extensions: ${{ env.extensions }}
96+
extensions: ${{ env.EXTENSIONS }}
10197
ini-values: date.timezone='UTC'
10298
coverage: pcov
10399
tools: composer:v2, pecl
104100

105-
- name: Update composer
101+
- name: Update composer.
106102
run: composer self-update
107103

108-
- name: Install db-mssql
104+
- name: Set environment variables pull request linux.
105+
uses: ./.github/actions/environment-linux
106+
107+
- name: Install db-mssql.
109108
uses: ./.github/actions/subpackage_install
110109
with:
110+
BRANCH_NAME: ${{ github.head_ref }}
111+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
111112
CURRENT_PACKAGE: db-mssql
112-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
113113
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
114-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
115114
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
116115

117-
# - name: Install db-mssql
118-
# run: composer require yiisoft/db-mssql:${{ env.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
119-
120-
- name: Install db-mysql
116+
- name: Install db-mysql.
121117
uses: ./.github/actions/subpackage_install
122118
with:
119+
BRANCH_NAME: ${{ github.head_ref }}
120+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
123121
CURRENT_PACKAGE: db-mysql
124-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
125122
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
126-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
127123
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
128124

129-
# - name: Install db-mysql
130-
# run: composer require yiisoft/db-mysql:${{ env.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
131-
132-
- name: Install db-pgsql
125+
- name: Install db-pgsql.
133126
uses: ./.github/actions/subpackage_install
134127
with:
128+
BRANCH_NAME: ${{ github.head_ref }}
129+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
135130
CURRENT_PACKAGE: db-pgsql
136-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
137131
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
138-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
139132
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
140133

141-
# - name: Install db-pgsql
142-
# run: composer require yiisoft/db-pgsql:${{ env.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
143-
144-
- name: Install db-oracle
134+
- name: Install db-oracle.
145135
uses: ./.github/actions/subpackage_install
146136
with:
137+
BRANCH_NAME: ${{ github.head_ref }}
138+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
147139
CURRENT_PACKAGE: db-oracle
148-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
149140
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
150-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
151141
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
152142

153-
# - name: Install db-oracle
154-
# run: composer require yiisoft/db-oracle:${{ env.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
155-
156-
- name: Install db-sqlite
143+
- name: Install db-sqlite.
157144
uses: ./.github/actions/subpackage_install
158145
with:
146+
BRANCH_NAME: ${{ github.head_ref }}
147+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
159148
CURRENT_PACKAGE: db-sqlite
160-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
161149
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
162-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
163150
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
164151

165-
# - name: Install db-sqlite
166-
# run: composer require yiisoft/db-sqlite:${{ env.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
167-
168-
- name: Install active-record
152+
- name: Install active-record.
169153
uses: ./.github/actions/subpackage_install
170154
with:
155+
BRANCH_NAME: ${{ github.head_ref }}
156+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
171157
CURRENT_PACKAGE: active-record
172-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
173158
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
174-
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
175159
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
176160

177-
# - name: Install active-record
178-
# run: composer require yiisoft/active-record:${{ env.COMPOSER_ROOT_VERSION }} --no-interaction --no-progress --optimize-autoloader --ansi
179-
180-
- name: Run tests with phpunit with code coverage
161+
- name: Run tests with phpunit with code coverage.
181162
run: vendor/bin/phpunit --testsuite ActiveRecord --coverage-clover=coverage.xml --colors=always
182163

183-
# - name: Upload coverage to Codecov(disabled)
184-
# if: matrix.php == '8.1'
185-
# uses: codecov/codecov-action@v3
186-
# with:
187-
# token: ${{ secrets.CODECOV_TOKEN }}
188-
# files: ./coverage.xml
164+
- name: Upload coverage to Codecov.
165+
if: matrix.php == '8.1'
166+
uses: codecov/codecov-action@v3
167+
with:
168+
token: ${{ secrets.CODECOV_TOKEN }}
169+
files: ./coverage.xml

.github/workflows/db-mssql.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
BRANCH_NAME: ${{ github.head_ref }}
31-
FULL_BRANCH_NAME: dev-${{ github.head_ref }}
32-
WORK_PACKAGE: db-mssql
33-
WORK_PACKAGE_URL: https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/
34-
extensions: pdo, pdo_sqlsrv-5.10.1
30+
CURRENT_PACKAGE: db-mssql
31+
EXTENSIONS: pdo, pdo_sqlsrv-5.10.1
3532

3633
runs-on: ${{ matrix.os }}
3734

@@ -72,7 +69,7 @@ jobs:
7269
uses: shivammathur/setup-php@v2
7370
with:
7471
php-version: ${{ matrix.php }}
75-
extensions: ${{ env.extensions }}
72+
extensions: ${{ env.EXTENSIONS }}
7673
ini-values: date.timezone='UTC'
7774
coverage: pcov
7875
tools: composer:v2, pecl
@@ -82,13 +79,16 @@ jobs:
8279
- name: Update composer.
8380
run: composer self-update
8481

82+
- name: Set environment variables pull request linux.
83+
uses: ./.github/actions/environment-linux
84+
8585
- name: Install db-mssql.
8686
uses: ./.github/actions/subpackage_install
8787
with:
88-
CURRENT_PACKAGE: db-mssql
89-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
90-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
88+
BRANCH_NAME: ${{ github.head_ref }}
9189
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
90+
CURRENT_PACKAGE: ${{ env.CURRENT_PACKAGE }}
91+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
9292
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
9393

9494
- name: Run mssql tests with phpunit and code coverage.

.github/workflows/db-mysql.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ jobs:
2727

2828
env:
2929
COMPOSER_ROOT_VERSION: dev-master
30-
BRANCH_NAME: ${{ github.head_ref }}
31-
FULL_BRANCH_NAME: dev-${{ github.head_ref }}
32-
WORK_PACKAGE: db-mysql
33-
WORK_PACKAGE_URL: https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/
34-
extensions: pdo, pdo_mysql
30+
CURRENT_PACKAGE: db-mysql
31+
EXTENSIONS: pdo, pdo_mysql
3532

3633
runs-on: ${{ matrix.os }}
3734

@@ -68,20 +65,23 @@ jobs:
6865
uses: shivammathur/setup-php@v2
6966
with:
7067
php-version: ${{ matrix.php }}
71-
extensions: ${{ env.extensions }}
68+
extensions: ${{ env.EXTENSIONS }}
7269
ini-values: date.timezone='UTC'
7370
coverage: pcov
7471

7572
- name: Update composer.
7673
run: composer self-update
7774

75+
- name: Set environment variables pull request linux.
76+
uses: ./.github/actions/environment-linux
77+
7878
- name: Install db-mysql.
7979
uses: ./.github/actions/subpackage_install
8080
with:
81-
CURRENT_PACKAGE: db-mysql
82-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
83-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
81+
BRANCH_NAME: ${{ github.head_ref }}
8482
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
83+
CURRENT_PACKAGE: ${{ env.CURRENT_PACKAGE }}
84+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
8585
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
8686

8787
- name: Run Mssql tests with phpunit and code coverage.

.github/workflows/db-oracle.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@ jobs:
2626
name: PHP ${{ matrix.php }}-${{ matrix.oracle }}
2727

2828
env:
29+
CURRENT_PACKAGE: db-oracle
2930
COMPOSER_ROOT_VERSION: dev-master
30-
BRANCH_NAME: ${{ github.head_ref }}
31-
FULL_BRANCH_NAME: dev-${{ github.head_ref }}
32-
WORK_PACKAGE: db-oracle
33-
WORK_PACKAGE_URL: https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/
34-
extensions: pdo, pdo_oci
31+
EXTENSIONS: pdo, pdo_oci
3532

3633
runs-on: ${{ matrix.os }}
3734

@@ -71,21 +68,24 @@ jobs:
7168
uses: shivammathur/setup-php@v2
7269
with:
7370
php-version: ${{ matrix.php }}
74-
extensions: ${{ env.extensions }}
71+
extensions: ${{ env.EXTENSIONS }}
7572
ini-values: date.timezone='UTC'
7673
coverage: pcov
7774
tools: composer:v2, pecl
7875

7976
- name: Update composer.
8077
run: composer self-update
8178

79+
- name: Set environment variables pull request linux.
80+
uses: ./.github/actions/environment-linux
81+
8282
- name: Install db-oracle.
8383
uses: ./.github/actions/subpackage_install
8484
with:
85-
CURRENT_PACKAGE: db-oracle
86-
BRANCH_NAME: ${{ env.BRANCH_NAME }}
87-
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
85+
BRANCH_NAME: ${{ github.head_ref }}
8886
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
87+
CURRENT_PACKAGE: ${{ env.CURRENT_PACKAGE }}
88+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
8989
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
9090

9191
- name: Run oracle tests with phpunit and code coverage.

0 commit comments

Comments
 (0)