Skip to content

Commit

Permalink
chore: introduce rust extension
Browse files Browse the repository at this point in the history
Signed-off-by: azjezz <azjezz@protonmail.com>
  • Loading branch information
azjezz committed Nov 20, 2022
1 parent 657ce98 commit c60b8e9
Show file tree
Hide file tree
Showing 46 changed files with 1,416 additions and 193 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -29,6 +29,7 @@
/config export-ignore
/tests export-ignore
/docs export-ignore
/extension export-ignore

# Avoid merge conflicts in CHANGELOG
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
Expand Down
68 changes: 68 additions & 0 deletions .github/actions/setup/action.yml
@@ -0,0 +1,68 @@
name: 'setup PSL developement envrionment'

inputs:
os:
required: true
php:
required: true
rust:
required: false
default: 'stable'
coverage:
required: false
default: 'xdebug'

runs:
using: 'composite'
steps:
- name: "installing PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ inputs.php }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
extensions: bcmath, mbstring, intl, sodium, json
coverage: ${{ inputs.coverage }}

- name: "installing Rust"
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ inputs.rust }}
override: true
components: rustfmt, clippy

- name: "installing LLVM, and Clang"
if: "!contains(inputs.os, 'windows')"
id: clang
uses: KyleMayes/install-llvm-action@v1
with:
version: '13.0'
directory: ${{ runner.temp }}/llvm

- name: "configuring Clang"
shell: bash
if: "!contains(inputs.os, 'windows')"
run: |
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
- name: "configuring Clang for macOS"
shell: bash
if: "contains(inputs.os, 'macos')"
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV

- name: "caching dependencies"
uses: "actions/cache@v3"
with:
path: |
~/.composer/cache
vendor
~/.cargo
extension/target
key: "php-${{ inputs.php }}-rust-${{ inputs.rust }}-os-${{ inputs.os }}"
restore-keys: "php-${{ inputs.php }}-rust-${{ inputs.rust }}-os-${{ inputs.os }}"

- name: "installing dependencies"
shell: bash
run: |
make install
37 changes: 12 additions & 25 deletions .github/workflows/benchmarks.yml
Expand Up @@ -5,42 +5,29 @@ on:
push: ~

jobs:
unit-tests:
benchmarks:
name: "benchmarks"

runs-on: ${{ matrix.operating-system }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
php-version:
php:
- "8.1"
operating-system:
os:
- "ubuntu-latest"
- "macos-latest"

steps:
- name: "checkout"
uses: "actions/checkout@v3"

- name: "installing PHP"
uses: "shivammathur/setup-php@v2"
- name: setup
uses: ./.github/actions/setup
with:
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
extensions: bcmath, mbstring, intl, sodium, json
php: ${{ matrix.php }}
os: ${{ matrix.os }}
coverage: 'none'

- name: "caching dependencies"
uses: "actions/cache@v3"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
restore-keys: "php-${{ matrix.php-version }}"

- name: "installing dependencies"
run: |
make install -j10 -O
- name: "running benchmarks"
run: make benchmarks
- name: "benchmarking PSL extension"
run: make benchmark-extension
16 changes: 4 additions & 12 deletions .github/workflows/code-coverage.yml
Expand Up @@ -7,24 +7,16 @@ on:
jobs:
code-coverage:
name: "code coverage"

runs-on: "ubuntu-latest"

steps:
- name: "checkout"
uses: "actions/checkout@v3"

- name: "installing PHP"
uses: "shivammathur/setup-php@v2"
- name: setup
uses: ./.github/actions/setup
with:
php-version: "8.1"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
extensions: bcmath, mbstring, intl, sodium, json

- name: "installing dependencies"
run: |
make install -j10 -O
php: "8.1"
os: "ubuntu-latest"

- name: "sending code coverage to coveralls"
env:
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/coding-standards.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/documentation-check.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,25 @@
name: "lint"

on:
pull_request: ~
push: ~

jobs:
lint:
name: "lint"
runs-on: "ubuntu-latest"
steps:
- name: "checkout"
uses: "actions/checkout@v3"

- name: setup
uses: ./.github/actions/setup
with:
php: "8.1"
os: "ubuntu-latest"

- name: "checking if documentation is up-to-date."
run: "php docs/documenter.php check"

- name: "checking coding standards"
run: make coding-standard-check
34 changes: 5 additions & 29 deletions .github/workflows/mutation-tests.yml
Expand Up @@ -7,40 +7,16 @@ on:
jobs:
mutation-tests:
name: "mutation tests"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
php-version:
- "8.1"
operating-system:
- "ubuntu-latest"

runs-on: "ubuntu-latest"
steps:
- name: "checkout"
uses: "actions/checkout@v3"

- name: "installing PHP"
uses: "shivammathur/setup-php@v2"
- name: setup
uses: ./.github/actions/setup
with:
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
extensions: bcmath, mbstring, intl, sodium, json

- name: "caching dependencies"
uses: "actions/cache@v3"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
restore-keys: "php-${{ matrix.php-version }}"

- name: "installing dependencies"
run: |
make install -j10
php: "8.1"
os: "ubuntu-latest"

- name: "running mutation tests"
run: make mutation-tests
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/security-analysis.yml

This file was deleted.

17 changes: 7 additions & 10 deletions .github/workflows/static-analysis.yml
Expand Up @@ -14,20 +14,17 @@ jobs:
- name: "checkout"
uses: "actions/checkout@v3"

- name: "installing PHP"
uses: "shivammathur/setup-php@v2"
- name: setup
uses: ./.github/actions/setup
with:
php-version: "8.1"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
extensions: bcmath, mbstring, intl, sodium, json

- name: "installing dependencies"
run: |
make install -j10 -O
php: "8.1"
os: "ubuntu-latest"

- name: "running static analysis"
run: make static-analysis

- name: "running security analysis"
run: make security-analysis

- name: "calculating type coverage"
run: make type-coverage
32 changes: 8 additions & 24 deletions .github/workflows/unit-tests.yml
Expand Up @@ -8,43 +8,27 @@ jobs:
unit-tests:
name: "unit tests"

runs-on: ${{ matrix.operating-system }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
php-version:
php:
- "8.1"
- "8.2"
operating-system:
# MacOs has a floating-point problem.
# - "macos-latest"
os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"

steps:
- name: "checkout"
uses: "actions/checkout@v3"

- name: "installing PHP"
uses: "shivammathur/setup-php@v2"
- name: setup
uses: ./.github/actions/setup
with:
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
extensions: bcmath, mbstring, intl, sodium, json

- name: "caching dependencies"
uses: "actions/cache@v3"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
restore-keys: "php-${{ matrix.php-version }}"

- name: "installing dependencies"
run: |
make install -j10
php: ${{ matrix.php }}
os: ${{ matrix.os }}

- name: "running unit tests"
run: ./vendor/bin/phpunit -c config/phpunit.xml.dist

0 comments on commit c60b8e9

Please sign in to comment.