Skip to content

Commit

Permalink
move licensed check to gh action and use v4 instead of v3
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Jul 23, 2023
1 parent d79428c commit 59ed1ae
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 73 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ on:
branches:
- main
pull_request:

jobs:

# git diff --exit-code dist

test-setup-spark:
name: Run setup Spark
name: ☑️ Run setup-spark
runs-on: ${{ matrix.versions.os }}
strategy:
matrix:
Expand Down Expand Up @@ -50,7 +53,7 @@ jobs:
test-setup-spark-scala:
name: 🛢️ Test setup with specific Scala version
name: 🛢️ Run setup-spark with given Scala version
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -82,7 +85,7 @@ jobs:


test-setup-spark-url:
name: 🔗 Test setup with given URL
name: 🔗 Run setup-spark with given URL
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -129,10 +132,34 @@ jobs:
uses: github/codeql-action/analyze@v2


check-license:
name: 📜 Check licenses and eslint
lint:
name: Check with ESlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run test

check-license:
name: 📜 Check licenses
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
- uses: github/setup-licensed@v1
with:
version: 4.x

- run: npm ci

- uses: github/licensed-ci@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: 📜 Auto-update license files
workflow: push
39 changes: 0 additions & 39 deletions .licenses/npm/uuid-3.4.0.dep.yml

This file was deleted.

29 changes: 4 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,20 @@ git checkout -b my-branch

## 👩‍💻 Development

Checkout the only important file! The mighty [`src/setup-spark.ts`](https://github.com/vemonet/setup-spark/blob/main/src/setup-spark.ts)

The Spark installation has been built based on the [jupyter/docker-stack PySpark notebook Dockerfile](https://github.com/jupyter/docker-stacks/blob/master/pyspark-notebook/Dockerfile)

In order to avoid uploading `node_modules/` to the repository, we use [vercel/ncc](https://github.com/vercel/ncc) to create a single `index.js` file that gets saved in `dist/`.
Checkout the only important file! The mighty [`src/setup-spark.ts`](https://github.com/vemonet/setup-spark/blob/main/src/setup-spark.ts). The Spark installation has been inspired by the [jupyter/docker-stack pyspark Dockerfile](https://github.com/jupyter/docker-stacks/blob/master/pyspark-notebook/Dockerfile)

1. Install:

```bash
npm install
```

2. Build the `index.js` file:
2. Build the `dist/index.js` file with [vercel/ncc](https://github.com/vercel/ncc):

```bash
npm run build
```

This also generates the javascript files from TypeScript files. Any files generated using `tsc` will be added to `lib/`, however those files also are not uploaded to the repository and are excluded using `.gitignore`.

3. Commit and push the generated `index.js` file with the rest of the modified files

## ☑️ Test
Expand All @@ -59,30 +53,15 @@ Format the code with prettier:
npm run fmt
```

Run licensed and eslint checks:
Run linting checks:

```bash
npm run test
```

## 📜 Check dependencies licenses

This repository uses a tool called [Licensed](https://github.com/github/licensed) to verify third party dependencies.

[Download licensed](https://github.com/github/licensed/releases/download/3.1.0/licensed-3.1.0-linux-x64.tar.gz):

```bash
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.1.0/licensed-3.1.0-linux-x64.tar.gz
tar -xzf licensed.tar.gz && rm -f licensed.tar.gz
```

Run `licensed` locally and generate the license dependencies in `.licenses` use:

```bash
./licensed cache
```

If you have not licensed installed, this is not a problem, we will do it the next time we pull the changes.
Third party dependencies licenses are checked automatically by a GitHub Action workflow using [Licensed](https://github.com/github/licensed).

## 🔼 Updating dependencies

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
"main": "dist/index.js",
"private": true,
"scripts": {
"postinstall": "curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.1.0/licensed-3.1.0-linux-x64.tar.gz && tar -xzf licensed.tar.gz",
"fmt": "prettier --write **/*.ts",
"build": "npm run fmt && tsc && ncc build lib/setup-spark.js && ./licensed cache",
"build": "npm run fmt && tsc && ncc build lib/setup-spark.js",
"dev": "npm run build && act -j test-setup-spark-scala",
"test": "prettier --check **/*.ts && eslint ./src/**.ts --ignore-path .gitignore && ./licensed status",
"release": "git tag -fa v1 -m 'v1' && git push -f origin v1"
"test": "prettier --check **/*.ts && eslint ./src/**.ts --ignore-path .gitignore",
"release": "git tag -fa v1 -m 'v1' && git push -f origin v1",
"install-licensed": "curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.1.0/licensed-3.1.0-linux-x64.tar.gz && tar -xzf licensed.tar.gz",
"licensed": "./licensed cache"
},
"dependencies": {
"@actions/core": "^1.10.0",
Expand Down

0 comments on commit 59ed1ae

Please sign in to comment.