Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option 'path-type' #14

Merged
merged 4 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,25 @@ jobs:
update: True
msystem: ${{ matrix.task }}
- run: msys2do ./test.sh ${{ matrix.task }}

MSYS2_PATH_TYPE:
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

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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ Furthermore, the environment variable can be overriden. This is useful when mult
msys2do <command to test the package>
```

#### 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 <command>
```

```yaml
- uses: numworks/setup-msys2@v1
- run: msys2do <command>
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`:
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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=' + core.getInput('path-type'),
`%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"`
].join('\r\n'));

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
21 changes: 18 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
@@ -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