-
Notifications
You must be signed in to change notification settings - Fork 255
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
Create GitHub Actions Test Setup #652
Open
ronilan
wants to merge
13
commits into
mapbox:master
Choose a base branch
from
ronilan:Test-Create-GitHub-Actions-Test-Setup
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create GitHub Actions Test Setup #652
ronilan
wants to merge
13
commits into
mapbox:master
from
ronilan:Test-Create-GitHub-Actions-Test-Setup
Conversation
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
- Updated abi_crosswalk.json to include node 18 (current). - Added test coverage for cases of unsupported/unknown targets.
- Modified function signature. Instead of augmenting an object (side effect) the function now gets an options object and returns a configuration object. - Cleaned up of code auto used to extract bucket and region from s3 url. - Added comments. - Increased test coverage. - All tests pass.
- Modified versioning to add bucket name to hosted_path when s3ForcePathStyle is true. - Modified s3_setup to remove bucket name from prefix when s3ForcePathStyle is true. - Added test coverage for s3ForcePathStyle cases.
- mocking setup can be more easily used by automated tests and/or manually by developer. - mock modules moved to lib/mock. - mock modules are self contained and have a signature similar to that of other modules in the package. - simplified http mock to remove no longer needed interface. - modified http mock to support path style bucket access. - set http mock to work with default npg-mock-bucket bucket.
- separated s3 tests from build tests. - refactored fetch test and proxy-bcrypt test to work with refactored mock setup.
- set hosts of test apps to point to mock bucket. - added app1.1 - identical to app1 but using production and staging binary host option. - added app1.2 - identical to app1 but using explicit host, region, bucket options.
…is versa. Removed previous one.
- Added a GitHub Actions workflow that runs whenever there is a push to the repo. - Workflow includes two jobs: - A matrix job of node versions (10, 12, 14, 16, 18) and operating systems (Linux (ubuntu), Mac and Windows (2019 Enterprise)) that runs all tests against mock and then runs s3 tests against a bucket (located at us-east-1-bucket) specified as a repo secret. - A matrix job of and NW.js versions (0.64.0, 0.50.2) and node versions (10, 12, ,14, 16) that runs the NW.js test script.
- Modified `scripts/test-node-webkit.sh` so that it can now accept an NW.js version as input. This allows running the script in a GitHub Actions matrix. - Modified `test/run.util.js` so that it does not set `--msvs_version=2015` when running in GitHub Actions. This is required because current GitHub Actions runner do not support VS Studio 2015. - Added npm script command `test:s3` to `package.json` that runs only the s3 tests. This is required because invoking `npx tape test/s3.test.js` on windows does not work as expected. - Modified `test/proxy-bcrypt.test.js`. Removed uneeded CI conditionals and modified download directory setup/cleanup. Latter was required due to concurrency issues with running tests on Mac, resulting in uncatchable errors during directory removal originating from `rimraf`.
This was referenced May 19, 2022
(uri) => { | ||
const bucket = 'npg-mock-bucket'; | ||
const mockDir = uri.indexOf(bucket) === -1 ? `${basePath}/${bucket}` : basePath; | ||
const filepath = path.join(mockDir, uri.replace('%2B', '+')); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High
This replaces only the first occurrence of '%2B'.
function http_mock() { | ||
log.warn('mocking http requests to s3'); | ||
|
||
const baseHostname = 's3.us-east-1.amazonaws.com'; |
Check failure
Code scanning / CodeQL
Incomplete regular expression for hostnames High
This string, which is used as a regular expression , has an unescaped '.' before 'amazonaws.com', so it might match more hosts than expected.
here
Error loading related location
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces a GitHub Actions test setup that runs tests against both the mock S3 and a real S3 bucket. It also includes a beefed up NW.js test. The Action covers (roughly) all that is covered in the Travis and AppVeyor setups. It can run from any forked repo independent of Mapbox bucket setups (see: #613).
This pull request comes "on top" of (i.e. includes changes from) #651 (which in turn comes "on top" of #648, #649, #650).
Configuration
Running the tests against a real S3 bucket requires configuring the following repo secrets:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
S3_BUCKET
When not configured, the S3 tests are skipped.
Change
Created GitHub Actions Test Setup (7b8b09a).
Modified existing configurations to work with GitHub Actions Test setup (4cbbc79).
scripts/test-node-webkit.sh
so that it can now accept an NW.js version as input. This allows running the script in a GitHub Actions matrix.test/run.util.js
so that it does not set--msvs_version=2015
when running in GitHub Actions. This is required because current GitHub Actions runner do not support VS Studio 2015.test:s3
topackage.json
that runs only the s3 tests. This is required because invokingnpx tape test/s3.test.js
on windows does not work as expected.test/proxy-bcrypt.test.js
. Removed uneeded CI conditionals and modified download directory setup/cleanup. Latter was required due to concurrency issues with running tests on Mac, resulting in uncatchable errors during directory removal originating fromrimraf
.Test