-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Work around 'npm run ...' executing as different user * Remove codecov Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
- Loading branch information
1 parent
1d11fe2
commit 97473ab
Showing
2 changed files
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
npm install -g codecov | ||
# When running inside a Docker container, by default, we're root and all files belond to root. | ||
# However, calling the npm scripts (build, etc.) with 'npm run ...' runs the commands as user | ||
# ID=1001, which means we can't open or write to any files. Therefore, if we're in Docker, chown | ||
# everything under /__w (which is the workspace directory on the host: /home/runner/work) to user | ||
# ID=1001. See: | ||
# * https://github.com/ros-tooling/setup-ros/pull/521 | ||
# * https://github.com/npm/cli/issues/4589 | ||
docker_workdir="/__w" | ||
if [ -d "${docker_workdir}" ]; then | ||
chown -R 1001:1001 "${docker_workdir}" | ||
fi | ||
|
||
npm ci | ||
npm run build | ||
npm test | ||
|
||
# Upload code coverage result to Codecov | ||
codecov -f ./coverage/coverage-final.json \ | ||
--disable=detect --commit="${GITHUB_SHA}" \ | ||
--branch="${GITHUB_REF#refs/heads/}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters