From 0ebbf9ebc2b212f5a61f1c8f9d11dc2731448a69 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 27 Nov 2019 02:01:40 +0100 Subject: [PATCH 1/4] do not overwrite MSYS2_PATH_TYPE envvar --- .github/workflows/test.yml | 11 +++++++++++ index.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c208473..c518b06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,3 +102,14 @@ jobs: update: True msystem: ${{ matrix.task }} - run: msys2do ./test.sh ${{ matrix.task }} + + path_env: + runs-on: windows-latest + steps: + - uses: actions/setup-go@v1 + - uses: actions/checkout@v1 + - run: yarn + - uses: ./ + - run: msys2do go env + env: + MSYS2_PATH_TYPE: inherit diff --git a/index.js b/index.js index 948b776..f1f65fd 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,7 @@ async function run() { let cmd = path.join(dest, 'msys2do.cmd'); fs.writeFileSync(cmd, [ 'setlocal', - 'set MSYS2_PATH_TYPE=strict', + 'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=strict', `%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"` ].join('\r\n')); From e5f723853e8d535e3327a82ed6f0ea6f0a169716 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 27 Nov 2019 00:13:01 +0100 Subject: [PATCH 2/4] add option 'path-type' --- .github/workflows/test.yml | 13 ++++++++++++- README.md | 18 ++++++++++++++++++ action.yml | 4 ++++ index.js | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c518b06..551656b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -103,7 +103,7 @@ jobs: msystem: ${{ matrix.task }} - run: msys2do ./test.sh ${{ matrix.task }} - path_env: + MSYS2_PATH_TYPE: runs-on: windows-latest steps: - uses: actions/setup-go@v1 @@ -113,3 +113,14 @@ jobs: - run: msys2do go env env: MSYS2_PATH_TYPE: inherit + + path-type: + runs-on: windows-latest + steps: + - uses: actions/setup-go@v1 + - uses: actions/checkout@v1 + - run: yarn + - uses: ./ + with: + path-type: inherit + - run: msys2do go env diff --git a/README.md b/README.md index def97ed..b035c49 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,24 @@ Furthermore, the environment variable can be overriden. This is useful when mult msys2do ``` +#### path-type + +By default, `MSYS2_PATH_TYPE` is set to `strict` by `msys2do`. It is possible to override it either using an option or setting the environment variable explicitly: + +```yaml + - uses: numworks/setup-msys2@v1 + with: + path-type: inherit + - run: msys2do +``` + +```yaml + - uses: numworks/setup-msys2@v1 + - run: msys2do + env: + MSYS2_PATH_TYPE: inherit +``` + #### update By default, the installation is not updated; hence package versions are those of the installation tarball. By setting option `update` to `true`, the action will execute `pacman -Syu --no-confirm`: diff --git a/action.yml b/action.yml index d2ad173..2b14a02 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,10 @@ inputs: description: 'Variant of the environment to set by default: MSYS, MINGW32 or MINGW64' required: false default: 'MINGW64' + path-type: + description: 'Default value for MSYS2_PATH_TYPE environment variable: strict, inherit or minimal' + required: false + default: 'strict' update: description: 'Update MSYS2 installation through pacman' required: false diff --git a/index.js b/index.js index f1f65fd..ed76920 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,7 @@ async function run() { let cmd = path.join(dest, 'msys2do.cmd'); fs.writeFileSync(cmd, [ 'setlocal', - 'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=strict', + 'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=' + core.getInput('path-type'), `%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"` ].join('\r\n')); From fe430b76cceb28adfb6fb0cee607dd50efff3f71 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 27 Nov 2019 01:41:21 +0100 Subject: [PATCH 3/4] update test.sh --- test.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/test.sh b/test.sh index 9b34742..10235d3 100644 --- a/test.sh +++ b/test.sh @@ -1,10 +1,25 @@ #!/usr/bin/env sh -uname -a +ANSI_RED="\033[31m" +ANSI_CYAN="\033[36;1m" +ANSI_NOCOLOR="\033[0m" -env | grep MSYS +run_cmd() { + printf "${ANSI_CYAN}" + echo "$@" + printf "${ANSI_NOCOLOR}" + "$@" +} + +run_cmd uname -a + +env | run_cmd grep MSYSTEM + +if [ "x$MSYSTEM" != "xMSYS" ]; then + env | run_cmd grep MINGW +fi if [ "x$MSYSTEM" != "x$1" ]; then - echo "Error MSYSTEM: '$MSYSTEM' != '$1'" + printf "${ANSI_RED}Error MSYSTEM: '$MSYSTEM' != '$1'${ANSI_NOCOLOR}\n" exit 1 fi From 49a8b512d73c8c26e0364914d78543694c69e359 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 27 Nov 2019 02:05:25 +0100 Subject: [PATCH 4/4] bump @actions/core from 1.1.3 to 1.2.0 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf0785a..dcb674c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@actions/core": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.3.tgz", - "integrity": "sha512-2BIib53Jh4Cfm+1XNuZYYGTeRo8yiWEAUMoliMh1qQGMaqTF4VUlhhcsBylTu4qWmUx45DrY0y0XskimAHSqhw==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz", + "integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==" }, "@actions/exec": { "version": "1.0.1", diff --git a/package.json b/package.json index 32cb9f7..c1b776c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "homepage": "https://github.com/numworks/setup-msys2", "dependencies": { - "@actions/core": "^1.1.3", + "@actions/core": "^1.2.0", "@actions/exec": "^1.0.1", "@actions/tool-cache": "1.1.2" }