diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 79188a79..8acb3667 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,8 +23,16 @@ jobs: # extract tag part of github.ref PUSHED_VERSION=$(cut -d'/' -f3 <<< "$GITHUB_REF") LATEST_RELEASED_VERSION=$(curl -s https://raw.githubusercontent.com/netz98/n98-magerun2/master/version.txt | tr -d '[:space:]') - echo "pushed_version=$PUSHED_VERSION" >> $GITHUB_ENV - echo "latest_released_version=$LATEST_RELEASED_VERSION" >> $GITHUB_ENV + + # Check if curl was successful + if [[ -z "$LATEST_RELEASED_VERSION" ]]; then + echo "Failed to fetch the latest released version." + exit 1 + fi + + echo "pushed_version=\"$PUSHED_VERSION\"" >> "$GITHUB_ENV" + echo "latest_released_version=\"$LATEST_RELEASED_VERSION\"" >> "$GITHUB_ENV" + - uses: jackbilestech/semver-compare@1.0.4 if: startsWith(github.ref, 'refs/tags/') with: @@ -91,13 +99,23 @@ jobs: - name: rename phar file (tag) if: startsWith(github.ref, 'refs/tags/') run: | - # get tag part of github.ref + # Get tag part of github.ref TAG=$(cut -d'/' -f3 <<< "$GITHUB_REF") - LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/netz98/n98-magerun2/master/version.txt | tr -d '[:space:]') - cp n98-magerun2.phar n98-magerun2-${TAG}.phar - cp n98-magerun2.phar.asc n98-magerun2-${TAG}.phar.asc - mv n98-magerun2.phar n98-magerun2-latest.phar - mv n98-magerun2.phar.asc n98-magerun2-latest.phar.asc + LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/netz98/n98-magerun2/master/version.txt | tr -d '[:space:]') + + # Check if curl was successful + if [[ -z "$LATEST_VERSION" ]]; then + echo "Failed to fetch the latest version." + exit 1 + fi + + # Rename files + cp "n98-magerun2.phar" "n98-magerun2-${TAG}.phar" + cp "n98-magerun2.phar.asc" "n98-magerun2-${TAG}.phar.asc" + mv "n98-magerun2.phar" "n98-magerun2-latest.phar" + mv "n98-magerun2.phar.asc" "n98-magerun2-latest.phar.asc" + + # List files to verify ls -l - name: Upload phar file to files.magerun.net diff --git a/.github/workflows/mage-os_nightly_test.yml b/.github/workflows/mage-os_nightly_test.yml index 24fd9b80..6c63e6dc 100644 --- a/.github/workflows/mage-os_nightly_test.yml +++ b/.github/workflows/mage-os_nightly_test.yml @@ -52,10 +52,20 @@ jobs: - name: Install Mage-OS Nightly run: | - composer create-project --stability alpha --repository-url=https://upstream-nightly.mage-os.org magento/project-community-edition mage-os; - cd mage-os; + # Define variables + DB_PORT="${{ job.services.mysql.ports[3306] }}" + ES_PORT="${{ job.services.elasticsearch.ports[9200] }}" + DB_HOST="127.0.0.1:${DB_PORT}" + + # Create project + composer create-project --stability alpha --repository-url=https://upstream-nightly.mage-os.org magento/project-community-edition mage-os + + # Change directory + cd mage-os + + # Magento setup bin/magento setup:install \ - --db-host="127.0.0.1:${{ job.services.mysql.ports[3306] }}" \ + --db-host="$DB_HOST" \ --db-user=root \ --db-password=root \ --db-name=magento \ @@ -75,7 +85,7 @@ jobs: --admin-email="admin@example.com" \ --search-engine="elasticsearch7" \ --elasticsearch-host="127.0.0.1" \ - --elasticsearch-port=${{ job.services.elasticsearch.ports[9200] }}; + --elasticsearch-port="$ES_PORT" - name: Build phar file run: | diff --git a/.github/workflows/magento_platform_tests.yml b/.github/workflows/magento_platform_tests.yml index 61ef0679..70c926ab 100644 --- a/.github/workflows/magento_platform_tests.yml +++ b/.github/workflows/magento_platform_tests.yml @@ -183,7 +183,7 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - name: Cache Dependencies uses: actions/cache@v3 diff --git a/.github/workflows/phar_build_and_update.yml b/.github/workflows/phar_build_and_update.yml index 7c3d8204..c6c7f067 100644 --- a/.github/workflows/phar_build_and_update.yml +++ b/.github/workflows/phar_build_and_update.yml @@ -1,7 +1,25 @@ --- name: Phar build and update test -on: [push, pull_request] +on: + push: + paths: + - "bin/**" + - "config.yaml" + - "composer.json" + - "composer.lock" + - "res/**" + - "scoper.inc.php" + - "src/**" + pull_request: + paths: + - "bin/**" + - "config.yaml" + - "composer.json" + - "composer.lock" + - "res/**" + - "scoper.inc.php" + - "src/**" jobs: build: @@ -33,7 +51,8 @@ jobs: - name: Get Composer Cache Directory id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + shell: bash - uses: actions/cache@v3 with: diff --git a/.github/workflows/php_compatibility.yml b/.github/workflows/php_compatibility.yml index 2514989d..2260a710 100644 --- a/.github/workflows/php_compatibility.yml +++ b/.github/workflows/php_compatibility.yml @@ -1,8 +1,12 @@ --- name: PHP Compatibility on: - - push - - pull_request + push: + paths: + - "src/**" + pull_request: + paths: + - "src/**" env: MIN_PHP_VERSION: 7.4 diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index e7609bad..a62371a3 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -29,13 +29,14 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - # Find out info about how github is getting the hash + # Find out info about how GitHub is getting the hash - run: "git describe --tags --always --dirty" - run: "(git log --oneline | head -5) || true" - name: Get Composer Cache Directory id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + run: echo "dir=\"$(composer config cache-files-dir)\"" >> "$GITHUB_ENV" + shell: bash - uses: actions/cache@v3 with: @@ -49,10 +50,11 @@ jobs: run: composer install --prefer-dist --no-progress --no-suggest - name: Extract branch name - run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + run: echo "BRANCH_NAME=\"${GITHUB_REF#refs/heads/}\"" >> "$GITHUB_ENV" + shell: bash - name: Set application name - run: cat box.json.dist | jq -r '.replacements.application_name = "n98-magerun2-dev ${{ env.BRANCH_NAME }}"' > box.json + run: jq -r '.replacements.application_name = "n98-magerun2-dev ${{ env.BRANCH_NAME }}"' box.json.dist > box.json - name: Create phar run: bash ./build.sh diff --git a/.yaml-lint.yml b/.yaml-lint.yml new file mode 100644 index 00000000..1699589a --- /dev/null +++ b/.yaml-lint.yml @@ -0,0 +1,35 @@ +--- + +yaml-files: + - '*.yaml' + - '*.yml' + - '.yamllint' + +rules: + anchors: enable + braces: enable + brackets: enable + colons: enable + commas: enable + comments: + level: warning + comments-indentation: + level: warning + document-end: disable + document-start: + level: warning + empty-lines: enable + empty-values: disable + float-values: disable + hyphens: enable + indentation: enable + key-duplicates: enable + key-ordering: disable + line-length: disable + new-line-at-end-of-file: enable + new-lines: enable + octal-values: disable + quoted-strings: disable + trailing-spaces: enable + truthy: + level: warning