Skip to content

Commit

Permalink
feat(build): fluidattacks#1099 licensing builtin with reuse
Browse files Browse the repository at this point in the history
- Create `testLicense` builtin with reuse.
- Add job to dev pipeline

Signed-off-by: Robin Quintero <rohaquinlop301@gmail.com>
  • Loading branch information
rohaquinlop committed Jun 13, 2023
1 parent c18b4ab commit de36dbf
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 42 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,6 @@ jobs:
- name: /helloWorld
run: nix-env -if . && m . /helloWorld

linux_license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /license
with:
set-safe-directory: /github/workspace
args: sh -c "nix-env -if . && m . /license"
macos_license:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@67e9fd765dbe63fabe0ce2bd72f56f9a417696a0
- name: /license
run: nix-env -if . && m . /license

linux_lintBash:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -490,6 +473,23 @@ jobs:
- name: /taintTerraform/module
run: nix-env -if . && m . /taintTerraform/module

linux_testLicense:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /testLicense
with:
set-safe-directory: /github/workspace
args: sh -c "nix-env -if . && m . /testLicense"
macos_testLicense:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@67e9fd765dbe63fabe0ce2bd72f56f9a417696a0
- name: /testLicense
run: nix-env -if . && m . /testLicense

linux_testPython_cliMain:
runs-on: ubuntu-latest
steps:
Expand Down
38 changes: 17 additions & 21 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,27 +357,6 @@ jobs:
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

linux_license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /license
with:
set-safe-directory: /github/workspace
args: sh -c "nix-env -if . && m . /license"
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
macos_license:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@67e9fd765dbe63fabe0ce2bd72f56f9a417696a0
- name: /license
run: nix-env -if . && m . /license
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

linux_lintBash:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -721,6 +700,23 @@ jobs:
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

linux_testLicense:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /testLicense
with:
set-safe-directory: /github/workspace
args: sh -c "nix-env -if . && m . /testLicense"
macos_testLicense:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@67e9fd765dbe63fabe0ce2bd72f56f9a417696a0
- name: /testLicense
run: nix-env -if . && m . /testLicense

linux_testPython_example:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ John Perez <mrjohnjairo10@gmail.com> John Perez <mrjohnjairo10@gmail.com>
Kevin Amado <kamadorueda@gmail.com> Kevin Amado <kamadorueda@gmail.com>
Luis Saavedra <lsaavedra@fluidattacks.com> Luis David Saavedra <40694133+ludsrill@users.noreply.github.com>
Luis Saavedra <lsaavedra@fluidattacks.com> Luis Saavedra <lsaavedra@fluidattacks.com>
Robin Hafid <rohaquinlop301@gmail.com> Robin Hafid <rohaquinlop301@gmail.com>
Robin Quintero <rohaquinlop301@gmail.com> Robin Quintero <rohaquinlop301@gmail.com>
Timothy DeHerrera <tim.deherrera@iohk.io> Timothy DeHerrera <tim.deherrera@iohk.io>
24 changes: 24 additions & 0 deletions docs/src/api/builtins/test.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## testLicense

Test the license of a project using [reuse](https://reuse.software/).

Types:

- testLicense: Empty attribute set.

Example:

=== "makes.nix"

```nix
{
testLicense = {};
}
```

=== "Invocation"

```bash
m . /testLicense
```

## testPullRequest

Test a pull request
Expand Down
1 change: 1 addition & 0 deletions makes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
};
};
};
testLicense = {};
testPython = {
example = {
python = "3.11";
Expand Down
1 change: 1 addition & 0 deletions src/args/agnostic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
stringCapitalize = import ./string-capitalize/default.nix self;
sublist = import ./sublist/default.nix self;
taintTerraform = import ./taint-terraform/default.nix self;
testLicense = import ./test-license/default.nix self;
testTerraform = import ./test-terraform/default.nix self;
testPullRequest = import ./test-pull-request/default.nix self;
testPython = import ./test-python/default.nix self;
Expand Down
8 changes: 4 additions & 4 deletions makes/license/main.nix → src/args/test-license/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
inputs,
__nixpkgs__,
makeScript,
...
}:
makeScript {
name = "test-license";
entrypoint = ./entrypoint.sh;
name = "license";
searchPaths.bin = [
inputs.nixpkgs.git
inputs.nixpkgs.reuse
__nixpkgs__.git
__nixpkgs__.reuse
];
}
File renamed without changes.
1 change: 1 addition & 0 deletions src/evaluator/modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
(import ./secure-kubernetes-with-rbac-police/default.nix args)
(import ./secure-python-with-bandit/default.nix args)
(import ./taint-terraform/default.nix args)
(import ./test-license/default.nix args)
(import ./test-pull-request/default.nix args)
(import ./test-python/default.nix args)
(import ./test-terraform/default.nix args)
Expand Down
14 changes: 14 additions & 0 deletions src/evaluator/modules/test-license/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{testLicense, ...}: {
config,
lib,
...
}: {
options = {
testLicense = {};
};
config = {
outputs = {
"/testLicense" = testLicense;
};
};
}

0 comments on commit de36dbf

Please sign in to comment.