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 a new "location" option #173

Merged
merged 1 commit into from
Oct 28, 2021
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
18 changes: 18 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,21 @@ jobs:
uses: ./
with:
platform-check-severity: warn

location:
needs: [cache]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: action
- name: run action
uses: ./
with:
location: 'D:\'
update: false
- shell: msys2 {0}
run: |
cygpath -m /

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ The package or list of packages are installed through `pacman --noconfirm -S --n
git
base-devel
```

#### platform-check-severity

By default (`fatal`), throw an error if the runner OS is not Windows.
Expand All @@ -221,3 +222,13 @@ If set to `warn`, simply log a message and skip the rest:
with:
platform-check-severity: warn
```

#### location

Specify the location where to install msys2:

```yaml
- uses: msys2/setup-msys2@v2
with:
location: D:\
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
description: 'What to do when run on an incompatible runner: fatal, warn'
required: false
default: 'fatal'
location:
description: 'Where to install msys2'
required: false
default: 'RUNNER_TEMP'
runs:
using: 'node12'
main: 'index.js'
13 changes: 11 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function parseInput() {
let p_msystem = core.getInput('msystem');
let p_install = core.getInput('install');
let p_platformcheckseverity = core.getInput('platform-check-severity');
let p_location = core.getInput('location');

const msystem_allowed = ['MSYS', 'MINGW32', 'MINGW64', 'UCRT64', 'CLANG32', 'CLANG64'];
if (!msystem_allowed.includes(p_msystem.toUpperCase())) {
Expand All @@ -42,13 +43,20 @@ function parseInput() {
throw new Error(`'platform-check-severity' needs to be one of ${ platformcheckseverity_allowed.join(', ') }, got ${p_platformcheckseverity}`);
}

if ( process.platform === 'win32' && (p_location === 'C:\\' || p_location === 'C:') ) {
throw new Error(`'location' cannot be 'C:' because that contains the built-in MSYS2 installation
in GitHub Actions environments. See option 'release', in order to use that installation:
https://github.com/msys2/setup-msys2#release`);
}

return {
release: p_release,
update: p_update,
pathtype: p_pathtype,
msystem: p_msystem,
install: p_install,
platformcheckseverity: p_platformcheckseverity,
location: (p_location == "RUNNER_TEMP") ? process.env['RUNNER_TEMP'] : p_location,
}
}

Expand Down Expand Up @@ -220,7 +228,8 @@ async function run() {
let msysRootDir = path.join('C:', 'msys64');
if (input.release) {
// Use upstream package instead of the default installation in the virtual environment.
msysRootDir = path.join(tmp_dir, 'msys64');
let dest = (input.location) ? input.location : tmp_dir;
msysRootDir = path.join(dest, 'msys64');
eine marked this conversation as resolved.
Show resolved Hide resolved

if (INSTALL_CACHE_ENABLED) {
instCache = new InstallCache(msysRootDir, input);
Expand All @@ -234,7 +243,7 @@ async function run() {
let inst_dest = await downloadInstaller();

changeGroup('Extracting MSYS2...');
await exec.exec(inst_dest, ['-y'], {cwd: tmp_dir});
await exec.exec(inst_dest, ['-y'], {cwd: dest});

changeGroup('Disable Key Refresh...');
await disableKeyRefresh(msysRootDir);
Expand Down