Skip to content

Commit

Permalink
initial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Raj-StepSecurity committed Nov 27, 2024
1 parent c7e2e44 commit 0863404
Show file tree
Hide file tree
Showing 27 changed files with 8,387 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
/dist
/node_modules
.eslintrc.js
*.js
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [lukka]
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
21 changes: 21 additions & 0 deletions .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release GitHub Actions

on:
workflow_dispatch:
inputs:
tag:
description: "Tag for the release"
required: true

permissions:
contents: read

jobs:
release:
permissions:
actions: read
id-token: write
contents: write
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
with:
tag: "${{ github.event.inputs.tag }}"
120 changes: 120 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: 'build-test'

on:
push:
pull_request:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:

jobs:
build_and_unit_test:
name: '${{ matrix.os }}: build and unit tests'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: lukka/get-cmake@latest
- uses: actions/setup-node@v4
with:
node-version: '20.x'
# How to consume GitHub packages, from this message (!): https://github.community/t/download-from-github-package-registry-without-authentication/14407/35
# Inspired from here: https://github.com/jcansdale-test/npmrc-configurations/blob/master/.github/workflows/blank.yml
- name: Authenticate to GitHub Packages
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com/" >> ~/.npmrc
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm run test
- run: npm run pack
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: ${{ matrix.os }}-build_and_unit_test
base-path: ${{ runner.os != 'macOS' && '__tests__/theAssets/vcpkg_project/' || '' }}
debug: true

tests:
name: '${{ matrix.os }}: functional tests'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: checkout this action
uses: actions/checkout@v4
with:
submodules: true

- uses: lukka/get-cmake@latest

- name: basic test for run-vcpkg (not running vcpkg).
uses: ./
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
vcpkgGitCommitId: '8eb57355a4ffb410a2e94c07b4dca2dffbee8e50'
vcpkgGitUrl: 'https://github.com/microsoft/vcpkg.git'

- name: basic test for run-vcpkg with running 'vcpkg install'.
uses: ./
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
vcpkgGitCommitId: '8eb57355a4ffb410a2e94c07b4dca2dffbee8e50'
runVcpkgInstall: true
vcpkgGitUrl: 'https://github.com/microsoft/vcpkg.git'
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed

- name: basic test for run-vcpkg with 'vcpkg-configuration.json'.
uses: ./
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
#vcpkgGitCommitId: is not provided intentionally, the Git commit it is read from vcpkg-configuration.json.
vcpkgConfigurationJsonGlob: '**/__tests__/theAssets/vcpkg_project/vcpkg-configuration.json'

tests_with_cache_hit:
needs: tests
name: '${{ matrix.os }}: functional tests'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: checkout this action
uses: actions/checkout@v4
with:
submodules: true

- uses: lukka/get-cmake@latest

- name: basic test for run-vcpkg (not running vcpkg).
uses: ./
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
vcpkgGitCommitId: '8eb57355a4ffb410a2e94c07b4dca2dffbee8e50'
vcpkgGitUrl: 'https://github.com/microsoft/vcpkg.git'

finalize_coveralls:
needs: build_and_unit_test
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Finalize Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
carryforward: "macos-latest-build_and_unit_test,ubuntu-latest-build_and_unit_test,windows-latest-build_and_unit_test"
debug: true
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
node_modules
**/*.js
*.map
*.js.log
token.txt
*.vsix
*.zip
.taskkey
.vscode
*.tgz
build
!dist
.npmrc
coverage
.DS_Store
__tests__/theAssets/
-__tests__/b
Empty file added .gitmodules
Empty file.
75 changes: 75 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Contributing
- [Contributing](#contributing)
- [Prerequisites](#prerequisites)
- [Setup for consuming GitHub Registry public packages](#setup-for-consuming-github-registry-public-packages)
- [Build and lint](#build-and-lint)
- [Packaging](#packaging)
- [Build and Package](#build-and-package)
- [Testing](#testing)

The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the [source code](https://github.com/lukka/run-vcpkg) with fixes and new features contributed by means of Pull Requests.


## Prerequisites

Run

```bash
> npm install
```

to populate the dependencies in `./node_modules` directory.

### Setup for consuming GitHub Registry public packages

`run-vcpkg` depends on public NPM packages published by [lukka/run-cmake-vcpkg-action-libs](https://github.com/lukka/run-cmake-vcpkg-action-libs) in the [GitHub Packages registry](https://docs.github.com/en/free-pro-team@latest/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages).
Unexpectedly, a public package still requires authentication when downloading it, hence if you want to `npm install` those packages correctly, you need to obtain a token with `read:packages` scope. Then create in the root of the repository a `.npmrc` file with the following content:

//npm.pkg.github.com/:_authToken=YOURTOKEN
@lukka:registry=https://npm.pkg.github.com/

__Note__: **Never commit this `.npmrc` file!**

## Build and lint
Build with `tsc` running:

```bash
> npm run build
```

Launch `lint` by:

```bash
> npm run lint
```

## Packaging
To package the extension for release purpose, run:

```bash
> npm run pack
```

## Build and Package

To run linter, build and package all:

```bash
> npm run repack
```

## Testing

To run the test suite:

```bash
> npm run test
```

To run a specific test by name:

```bash
> npx jest -t `<regular-expression>`
```

Validation tests on various scenarios are run using the workflows of the [Samples](./README.md#samples).
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2023 StepSecurity

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
20 changes: 20 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2019-2020-2021-2022-2023 Luca Cappa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 0863404

Please sign in to comment.