From d31ece1c757e9f47305447da134bad64207f6e1e Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 24 Oct 2022 09:48:30 -0600 Subject: [PATCH 1/3] nix: add flake with dev shell --- .editorconfig | 12 +++++++----- .gitignore | 1 + flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 22 ++++++++++++++++++++++ shell.nix | 17 +++++++++++++++++ 5 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/.editorconfig b/.editorconfig index c70b7be22..a04147116 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,15 +1,17 @@ root = true [*] -end_of_line = lf -insert_final_newline = true indent_style = space indent_size = 4 +tab_width = 4 +end_of_line = lf charset = utf-8 trim_trailing_whitespace = true - -[*.yml] -indent_size = 2 +insert_final_newline = true [*.md] trim_trailing_whitespace = false + +[*.{md,nix,yml,yaml}] +indent_size = 2 +tab_width = 2 diff --git a/.gitignore b/.gitignore index cf911a1de..4b5d02246 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ storage/framework/* /.idea /nbproject +/.direnv node_modules *.log diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..4a64ac964 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666539104, + "narHash": "sha256-jeuC+d375wHHxMOFLgu7etseCQVJuPNKoEc9X9CsErg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0e6df35f39651504249a05191f9a78d251707e22", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..050cc2415 --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Pterodactyl Panel"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = import nixpkgs {inherit system;}; + in { + devShell = import ./shell.nix {inherit pkgs;}; + } + ); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..afe21af5e --- /dev/null +++ b/shell.nix @@ -0,0 +1,17 @@ +{pkgs ? import {}}: +with pkgs; + mkShell rec { + buildInputs = [ + alejandra + (php81.buildEnv { + extensions = ({ enabled, all }: enabled ++ (with all; [ + redis + xdebug + ])); + extraConfig = '' + xdebug.mode=debug + ''; + }) + php81Packages.composer + ]; + } From 5c78b380c5c4cea06e5bc9a7e347231387f97706 Mon Sep 17 00:00:00 2001 From: Jelco <53396500+Jelcoo@users.noreply.github.com> Date: Wed, 26 Oct 2022 18:26:56 +0200 Subject: [PATCH 2/3] Fix InMemoryFilesystemAdapter (#4489) --- app/Extensions/Backups/BackupManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index 32df8f22d..944e8d790 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -104,7 +104,7 @@ class BackupManager */ public function createWingsAdapter(array $config): FilesystemAdapter { - return new InMemoryFilesystemAdapter(null); + return new InMemoryFilesystemAdapter(); } /** From 6f0bb43314ad86e4a721637f924aa8de27f97f37 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Wed, 26 Oct 2022 10:43:05 -0600 Subject: [PATCH 3/3] ci: cleanup, add dedicated lint workflow --- .github/workflows/{build.yml => build.yaml} | 11 ++++--- .github/workflows/{tests.yml => ci.yaml} | 24 +++++++-------- .github/workflows/{docker.yml => docker.yaml} | 4 +-- .github/workflows/lint.yaml | 29 +++++++++++++++++++ .../workflows/{release.yml => release.yaml} | 4 +-- 5 files changed, 51 insertions(+), 21 deletions(-) rename .github/workflows/{build.yml => build.yaml} (73%) rename .github/workflows/{tests.yml => ci.yaml} (72%) rename .github/workflows/{docker.yml => docker.yaml} (97%) create mode 100644 .github/workflows/lint.yaml rename .github/workflows/{release.yml => release.yaml} (98%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yaml similarity index 73% rename from .github/workflows/build.yml rename to .github/workflows/build.yaml index 5b4b7c5ca..4aca84ce8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yaml @@ -3,16 +3,19 @@ name: Build on: push: branches: - - 'develop' - - 'v2' + - "develop" + - "1.0-develop" pull_request: + branches: + - "develop" + - "1.0-develop" jobs: ui: name: UI runs-on: ubuntu-20.04 - if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')" strategy: + fail-fast: false matrix: node-version: [16] steps: @@ -23,7 +26,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' + cache: "yarn" - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/tests.yml b/.github/workflows/ci.yaml similarity index 72% rename from .github/workflows/tests.yml rename to .github/workflows/ci.yaml index 5486076dd..0e6f93b66 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/ci.yaml @@ -3,20 +3,22 @@ name: Tests on: push: branches: - - 'develop' - - 'v2' + - "develop" + - "1.0-develop" pull_request: + branches: + - "develop" + - "1.0-develop" jobs: tests: name: Tests runs-on: ubuntu-20.04 - if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')" strategy: fail-fast: false matrix: php: [8.0, 8.1] - database: ['mariadb:10.2', 'mysql:8'] + database: ["mariadb:10.2", "mysql:8"] services: database: image: ${{ matrix.database }} @@ -33,15 +35,15 @@ jobs: - name: Get cache directory id: composer-cache run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache uses: actions/cache@v3 with: - path: | - ~/.php_cs.cache - ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }} + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer-${{ matrix.php }}- - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -57,10 +59,6 @@ jobs: - name: Install dependencies run: composer install --no-interaction --no-progress --no-suggest --prefer-dist - - name: PHP CS Fixer - run: vendor/bin/php-cs-fixer fix --dry-run --diff - continue-on-error: true - - name: Unit tests run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit if: ${{ always() }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yaml similarity index 97% rename from .github/workflows/docker.yml rename to .github/workflows/docker.yaml index 1f7a44d5a..0e1a2b77e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yaml @@ -3,8 +3,8 @@ name: Publish Docker Image on: push: branches: - - 'develop' - - 'release/v*' + - "develop" + - "release/v*" jobs: push: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 000000000..709af4364 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,29 @@ +name: Lint + +on: + push: + branches: + - "develop" + - "1.0-develop" + pull_request: + branches: + - "develop" + - "1.0-develop" + +jobs: + lint: + name: Lint + runs-on: ubuntu-20.04 + steps: + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + tools: composer:v2 + coverage: none + + - name: PHP CS Fixer + run: vendor/bin/php-cs-fixer fix --dry-run --diff diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 98% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml index 26d5b9034..09ab86410 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yaml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - 'v*' + - "v*" jobs: release: @@ -17,7 +17,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16 - cache: 'yarn' + cache: "yarn" - name: Install dependencies run: yarn install --frozen-lockfile