Skip to content

Commit

Permalink
fix shellcheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench committed Sep 12, 2023
1 parent 1d3a3f1 commit 41811b3
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 21 deletions.
34 changes: 26 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
Expand Down Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/mage-os_nightly_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -75,7 +85,7 @@ jobs:
--admin-email="[email protected]" \
--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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/magento_platform_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/phar_build_and_update.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/php_compatibility.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
name: PHP Compatibility
on:
- push
- pull_request
push:
paths:
- "src/**"
pull_request:
paths:
- "src/**"

env:
MIN_PHP_VERSION: 7.4
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
35 changes: 35 additions & 0 deletions .yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 41811b3

Please sign in to comment.