Skip to content

Commit

Permalink
SC-6012 Move scripts to subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasz-kaminski-sonarsource committed Nov 3, 2022
1 parent eacc2c1 commit 436b3a9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
mkdir -p "${INSTALL_PATH}"
echo "- Test script behavior"
./create_install_path.sh > output
./scripts/create_install_path.sh > output
grep -v "::error::" output
- name: Non-existing nested in current dir
shell: bash
env:
INSTALL_PATH: '.sonar'
run: |
./create_install_path.sh > output
./scripts/create_install_path.sh > output
grep -v "::error::" output
test -d "${INSTALL_PATH}"
Expand All @@ -41,7 +41,7 @@ jobs:
env:
INSTALL_PATH: '~/third_party/.sonar'
run: |
./create_install_path.sh > output
./scripts/create_install_path.sh > output
grep -v "::error::" output
test -d "${INSTALL_PATH}"
Expand All @@ -50,7 +50,7 @@ jobs:
env:
INSTALL_PATH: ''
run: |
(./create_install_path.sh || echo "=== Script failed ===") > output
(./scripts/create_install_path.sh || echo "=== Script failed ===") > output
grep "::error::Empty installation path specified" output
grep "=== Script failed ===" output
Expand All @@ -59,7 +59,7 @@ jobs:
env:
INSTALL_PATH: '/non_creatable'
run: |
(./create_install_path.sh || echo "=== Script failed ===") > output
(./scripts/create_install_path.sh || echo "=== Script failed ===") > output
grep "::error::Failed to create non-existing installation path '/non_creatable'" output
grep "=== Script failed ===" output
Expand All @@ -72,7 +72,7 @@ jobs:
echo "content" > "${INSTALL_PATH}"
echo "- Test script behavior"
(./create_install_path.sh || echo "=== Script failed ===") > output
(./scripts/create_install_path.sh || echo "=== Script failed ===") > output
grep "::error::Installation path 'not_directory' is not a directory" output
grep "=== Script failed ===" output
Expand All @@ -87,7 +87,7 @@ jobs:
chmod -r "${INSTALL_PATH}"
echo "- Test script behavior"
(./create_install_path.sh || echo "=== Script failed ===") > output
(./scripts/create_install_path.sh || echo "=== Script failed ===") > output
grep "::error::Installation path 'not_readable' is not readable" output
grep "=== Script failed ===" output
Expand All @@ -101,7 +101,7 @@ jobs:
chmod -w "${INSTALL_PATH}"
echo "- Test script behavior"
(./create_install_path.sh || echo "=== Script failed ===") > output
(./scripts/create_install_path.sh || echo "=== Script failed ===") > output
grep "::error::Installation path 'not_writeable' is not writeable" output
grep "=== Script failed ===" output
Expand All @@ -121,7 +121,7 @@ jobs:
SONAR_HOST_URL: 'http://sonar-host.com'
SONAR_SCANNER_VERSION: 'vX.Y.Z.MMMM'
run: |
./configure_paths.sh > output
./scripts/configure_paths.sh > output
grep -v "::error::" output
echo "- Check sonar-scanner:"
Expand All @@ -142,7 +142,7 @@ jobs:
SONAR_HOST_URL: 'http://sonar-host.com'
SONAR_SCANNER_VERSION: 'vX.Y.Z.MMMM'
run: |
./configure_paths.sh > output
./scripts/configure_paths.sh > output
grep -v "::error::" output
echo "- Check sonar-scanner:"
Expand All @@ -163,7 +163,7 @@ jobs:
SONAR_HOST_URL: 'http://sonar-host.com'
SONAR_SCANNER_VERSION: 'vX.Y.Z.MMMM'
run: |
./configure_paths.sh > output
./scripts/configure_paths.sh > output
grep -v "::error::" output
echo "- Check sonar-scanner:"
Expand All @@ -184,7 +184,7 @@ jobs:
SONAR_HOST_URL: 'http://sonar-host.com'
SONAR_SCANNER_VERSION: 'vX.Y.Z.MMMM'
run: |
(./configure_paths.sh || echo "=== Script failed ===") > output
(./scripts/configure_paths.sh || echo "=== Script failed ===") > output
echo "- Check errors:"
grep "::error::Unsupported runner OS 'unsupportedOS'" output
Expand All @@ -206,7 +206,7 @@ jobs:
SHA_DOWNLOAD_URL: 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip.sha256'
TMP_ZIP_PATH: ${{ runner.temp }}/sonar-scanner.zip
run: |
./download.sh > output
./scripts/download.sh > output
test -f "$TMP_ZIP_PATH"
if [ -f "$TMP_ZIP_PATH.sha256" ]; then
echo "$TMP_ZIP_PATH.sha256 shouldn't exist"
Expand All @@ -221,7 +221,7 @@ jobs:
SHA_DOWNLOAD_URL: 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip.sha256'
TMP_ZIP_PATH: ${{ runner.temp }}/sonar-scanner.zip
run: |
./download.sh -v > output
./scripts/download.sh -v > output
test -f "$TMP_ZIP_PATH"
test -f "$TMP_ZIP_PATH".sha256
grep -v "::error::" output
Expand All @@ -230,7 +230,7 @@ jobs:
env:
INSTALL_PATH: ''
run: |
(./download.sh || echo "=== Script failed ===") > output
(./scripts/download.sh || echo "=== Script failed ===") > output
grep "::error::Failed to create" output
grep "=== Script failed ===" output
- name: Incorrect download url
Expand All @@ -239,7 +239,7 @@ jobs:
INSTALL_PATH: 'install-directory'
DOWNLOAD_URL: 'incorrect-url'
run: |
(./download.sh || echo "=== Script failed ===") > output
(./scripts/download.sh || echo "=== Script failed ===") > output
grep "::error::Failed to download 'incorrect-url'" output
grep "=== Script failed ===" output
- name: Incorrect SHA256 url
Expand All @@ -250,7 +250,7 @@ jobs:
SHA_DOWNLOAD_URL: incorrect-sha256-url
TMP_ZIP_PATH: ${{ runner.temp }}/sonar-scanner.zip
run: |
(./download.sh -v || echo "=== Script failed ===") > output
(./scripts/download.sh -v || echo "=== Script failed ===") > output
grep "::error::Failed to download 'incorrect-sha256-url'" output
grep "=== Script failed ===" output
Expand Down
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runs:
shell: bash
env:
INSTALL_PATH: ${{ inputs.installation-path }}
run: ${GITHUB_ACTION_PATH}/create_install_path.sh
run: ${GITHUB_ACTION_PATH}/scripts/create_install_path.sh

- name: Configure paths
id: configure_paths
Expand All @@ -47,7 +47,7 @@ runs:
INSTALL_PATH: ${{ inputs.installation-path }}
SONAR_HOST_URL: 'https://sonarcloud.io'
SONAR_SCANNER_VERSION: ${{ inputs.sonar-scanner-version }}
run: ${GITHUB_ACTION_PATH}/configure_paths.sh >> $GITHUB_OUTPUT
run: ${GITHUB_ACTION_PATH}/scripts/configure_paths.sh >> $GITHUB_OUTPUT

- name: Cache sonar-scanner installation
id: cache-sonar-tools
Expand All @@ -65,15 +65,15 @@ runs:
SHA_DOWNLOAD_URL: ${{ steps.configure_paths.outputs.sonar-scanner-url }}.sha256
INSTALL_PATH: ${{ inputs.installation-path }}
TMP_ZIP_PATH: ${{ runner.temp }}/sonar-scanner.zip
run: ${GITHUB_ACTION_PATH}/download.sh -v
run: ${GITHUB_ACTION_PATH}/scripts/download.sh -v

- name: Download and install build-wrapper
shell: bash
env:
DOWNLOAD_URL: ${{ steps.configure_paths.outputs.build-wrapper-url }}
INSTALL_PATH: ${{ inputs.installation-path }}
TMP_ZIP_PATH: ${{ runner.temp }}/build-wrapper.zip
run: ${GITHUB_ACTION_PATH}/download.sh
run: ${GITHUB_ACTION_PATH}/scripts/download.sh

- name: Setup action outputs
id: setup-outputs
Expand All @@ -85,7 +85,7 @@ runs:
BUILD_WRAPPER_DIR: ${{ steps.configure_paths.outputs.build-wrapper-dir }}
BUILD_WRAPPER_BIN: ${{ steps.configure_paths.outputs.build-wrapper-bin }}
run: |
source ${GITHUB_ACTION_PATH}/utils.sh
source ${GITHUB_ACTION_PATH}/scripts/utils.sh
echo "::group::Action outputs"
echo "SONAR_HOST_URL=${SONAR_HOST_URL}" >> $GITHUB_ENV
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 436b3a9

Please sign in to comment.