Skip to content

Commit 088bd96

Browse files
authored
ci: restore tests in gha, linting, license bump (#70)
* ci: restore tests in gha, linting, license bump Signed-off-by: vsoch <[email protected]>
1 parent 1960ebc commit 088bd96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1209
-1155
lines changed

.docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../CHANGELOG.md
1+
../CHANGELOG.md

.docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import os
2121
import sys
2222

23+
from recommonmark.parser import CommonMarkParser
24+
2325
sys.path.insert(0, os.path.abspath("."))
2426

2527
# -- General configuration ------------------------------------------------
@@ -55,7 +57,6 @@
5557
# You can specify multiple suffix as a list of string:
5658
#
5759
# source_suffix = ['.rst', '.md']
58-
from recommonmark.parser import CommonMarkParser
5960

6061
source_parsers = {
6162
".md": CommonMarkParser,

.github/dev-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pre-commit
2+
black==23.3.0
3+
isort
4+
flake8

.github/workflows/main.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: singularity-compose ci
22

33
on:
44
push:
@@ -8,26 +8,42 @@ on:
88
branches_ignore: []
99

1010
jobs:
11+
tests:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: singularityhub/install-singularity@main
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install pytest semver pytest-runner requests
20+
pip install .[all]
21+
22+
- name: Run unit tests
23+
run: |
24+
which singularity
25+
sudo cp /usr/local/bin/singularity /usr/bin/singularity
26+
pytest -sv scompose/tests/test_depends_on.py
27+
pytest -sv scompose/tests/test_client.py
28+
pytest -sv scompose/tests/test_utils.py
29+
pytest -sv scompose/tests/test_config.py
30+
1131
formatting:
1232
runs-on: ubuntu-latest
1333
steps:
14-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v4
1535

1636
- name: Setup black environment
1737
run: conda create --quiet --name black
1838

19-
- name: Check formatting with black
20-
run: |
21-
export PATH="/usr/share/miniconda/bin:$PATH"
22-
source activate black
23-
pip install black
24-
black --check scompose
39+
- name: Check Spelling
40+
uses: crate-ci/typos@7ad296c72fa8265059cc03d1eda562fbdfcd6df2 # v1.9.0
41+
with:
42+
files: ./docs/*.md ./docs/*/*.md ./README.md .docs/*.rst .docs/*/*.rst
2543

26-
- name: Check imports with pyflakes
44+
- name: Lint and format Python code
2745
run: |
2846
export PATH="/usr/share/miniconda/bin:$PATH"
2947
source activate black
30-
pip install pyflakes==2.4.0
31-
pyflakes scompose/utils
32-
# Will have some issues
33-
pyflakes scompose/client scompose/project scompose/config || true
48+
pip install -r .github/dev-requirements.txt
49+
pre-commit run --all-files

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
env
12
.eggs
23
.docs/_build
34
dist

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
exclude: ".all-contributorsrc"
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.3.0
5+
hooks:
6+
- id: check-added-large-files
7+
- id: check-case-conflict
8+
- id: check-docstring-first
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
- id: mixed-line-ending
12+
13+
- repo: local
14+
hooks:
15+
- id: black
16+
name: black
17+
language: python
18+
types: [python]
19+
entry: black
20+
21+
- id: isort
22+
name: isort
23+
args: [--filter-files]
24+
language: python
25+
types: [python]
26+
entry: isort
27+
28+
- id: flake8
29+
name: flake8
30+
language: python
31+
types: [python]
32+
entry: flake8

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CHANGELOG
22

3-
This is a manually generated log to track changes to the repository for each release.
4-
Each section should include general headers such as **Implemented enhancements**
3+
This is a manually generated log to track changes to the repository for each release.
4+
Each section should include general headers such as **Implemented enhancements**
55
and **Merged pull requests**. Critical items to know are:
66

77
- renamed commands
@@ -22,14 +22,14 @@ The versions coincide with releases on pypi.
2222
- fix module import used by check command (0.1.13)
2323
- adding jsonschema validation and check command (0.1.12)
2424
- implement configuration override feature
25-
- implement `--preview` argument for the `check` command
25+
- implement `--preview` argument for the `check` command
2626
- add network->enable option on composer file (0.1.11)
2727
- add network->allocate_ip option on composer file (0.1.10)
2828
- version 2.0 of the spec with added fakeroot network, start, exec, and run options (0.1.0)
29-
- stop option added (equivalent functionality to down)
29+
- stop option added (equivalent functionality to down)
3030
- spython version 0.1.0 with Singularity 3.x or greater required
3131

32-
## [0.0.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.0.x)
32+
## [0.0.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.0.x)
3333
- removed check for sudo when adding network flags (0.0.21)
3434
- singularity-compose down supporting timeout (0.0.20)
3535
- command, ability to associate arguments to the instance's startscript (0.0.19)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![DOI](https://zenodo.org/badge/188852712.svg)](https://zenodo.org/badge/latestdoi/188852712)
55

66
This is a simple orchestration library for Singularity containers, akin to
7-
Docker Compose. See the [specification](https://singularityhub.github.io/singularity-compose/#/spec/spec-1.0)
7+
Docker Compose. See the [specification](https://singularityhub.github.io/singularity-compose/#/spec/spec-1.0)
88
and the [documentation](https://singularityhub.github.io/singularity-compose) for
99
details, or more examples below.
1010

docs/README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ or services.
1414

1515
Singularity compose uses Singularity on the backend, so anything that would require sudo (root)
1616
permissions for Singularity is also required for Singularity compose. This includes most
17-
networking commands (e.g., asking to allocate ports) and builds from recipe files.
18-
However, if you are using Singularity v3.3 or higher, you can take advantage of
17+
networking commands (e.g., asking to allocate ports) and builds from recipe files.
18+
However, if you are using Singularity v3.3 or higher, you can take advantage of
1919
[fakeroot](https://sylabs.io/guides/3.3/user-guide/fakeroot.html) to try and get around this.
2020
The snippet below shows how to add fakeroot as an option under a build section:
2121

@@ -34,15 +34,15 @@ And a complete example is provided [here](https://github.com/singularityhub/sing
3434
3535
### Dependencies
3636
37-
Singularity Compose *must* use a version of [Singularity](https://sylabs.io/guides/latest/user-guide/)
37+
Singularity Compose *must* use a version of [Singularity](https://sylabs.io/guides/latest/user-guide/)
3838
3.2.1 or greater. It's recommended to use the latest (3.3.0 release at the time of this writing) otherwise there was
3939
a bug with some versions of 3.2.1. Singularity 2.x absolutely will not work.
4040
Python 3 is also required, as Python 2 is at end of life.
4141
4242
### singularity-compose.yml
4343
4444
For a singularity-compose project, it's expected to have a `singularity-compose.yml`
45-
in the present working directory. You can look at a simple example here, here is a
45+
in the present working directory. You can look at a simple example here, here is a
4646
version 1.0 spec (before we added networking and exec options):
4747

4848
```yaml
@@ -60,7 +60,7 @@ instances:
6060
- 80:80
6161
```
6262

63-
and [here](https://github.com/singularityhub/singularity-compose-examples/tree/4241ea8b4e068d93859acb7d2b924702815af0ce/v2.0/ping)
63+
and [here](https://github.com/singularityhub/singularity-compose-examples/tree/4241ea8b4e068d93859acb7d2b924702815af0ce/v2.0/ping)
6464
is a version 2.0 spec that shows adding networking and exec options:
6565

6666
```yaml
@@ -77,7 +77,7 @@ instances:
7777
options:
7878
- fakeroot
7979
exec:
80-
options:
80+
options:
8181
- "env-file=myvars.env"
8282
command: printenv SUPERHERO
8383
alp2:
@@ -95,17 +95,17 @@ instances:
9595
- alp1
9696
```
9797

98-
If you are familiar with [docker-compose](https://docs.docker.com/compose/)
99-
the file should look very familiar. A key difference is that instead of
100-
"services" we have "instances." And you guessed correctly - each
101-
section there corresponds to a
98+
If you are familiar with [docker-compose](https://docs.docker.com/compose/)
99+
the file should look very familiar. A key difference is that instead of
100+
"services" we have "instances." And you guessed correctly - each
101+
section there corresponds to a
102102
[Singularity instance](https://sylabs.io/guides/3.2/user-guide/running_services.html)
103103
that will be created. In this guide, we will walk through each of the sections
104104
in detail.
105105

106106
### Instance folders
107107

108-
Generally, each section in the yaml file corresponds with a container instance to be run,
108+
Generally, each section in the yaml file corresponds with a container instance to be run,
109109
and each container instance is matched to a folder in the present working directory.
110110
For example, if I give instruction to build an `nginx` instance from
111111
a `nginx/Singularity.nginx` file, I should have the
@@ -155,15 +155,15 @@ This will pull a container `nginx.sif` into a `nginx` context folder:
155155
```
156156

157157
It's less likely that you will be able to pull a container that is ready to
158-
go, as typically you will want to customize the
159-
[startscript](https://sylabs.io/guides/3.2/user-guide/definition_files.html#startscript)
158+
go, as typically you will want to customize the
159+
[startscript](https://sylabs.io/guides/3.2/user-guide/definition_files.html#startscript)
160160
for the instance. Now that we understand the basic organization, let's
161161
bring up some instances.
162162

163163
## Quick Start
164164

165-
For this quick start, we are going to use the
166-
[singularity-compose-simple](https://www.github.com/singularityhub/singularity-compose-simple)
165+
For this quick start, we are going to use the
166+
[singularity-compose-simple](https://www.github.com/singularityhub/singularity-compose-simple)
167167
example. Singularity has a networking issue that currently doesn't allow communication
168168
between multiple containers (due to iptables and firewall issues) so for now the most we
169169
can do is show you one container. First, install singularity-compose from pip:
@@ -255,7 +255,7 @@ $ singularity-compose exec app uname -a
255255
```
256256

257257
When you open your browser to [http://127.0.0.1](http://127.0.0.1)
258-
you should see the upload interface.
258+
you should see the upload interface.
259259

260260
![img/upload.png](img/upload.png)
261261

@@ -277,7 +277,7 @@ The images that you upload are stored in `images` at the root:
277277

278278
```bash
279279
$ ls images/
280-
2018-02-20-172617.jpg 40-acos.png _upload
280+
2018-02-20-172617.jpg 40-acos.png _upload
281281
```
282282

283283
And static files are in `static`.
@@ -349,7 +349,7 @@ $ singularity instance start \
349349

350350
Control and customization of these instances is probably the coolest (and not widely
351351
used) feature of Singularity. You can create your own network configurations,
352-
and customie the arguments to the command. Read [here](https://sylabs.io/guides/3.2/user-guide/running_services.html) for more detalis.
352+
and customize the arguments to the command. Read [here](https://sylabs.io/guides/3.2/user-guide/running_services.html) for more detalis.
353353

354354
## Commands
355355

@@ -360,7 +360,7 @@ Python API, see [here](/singularity-compose/api/).
360360

361361
The [specification](spec/) describes in more detail the sections of the singularity-compose.yml.
362362
For example, in the quick start above, we have a post command for the app instance
363-
that creates a series of folders on the host.
363+
that creates a series of folders on the host.
364364

365365
## Examples
366366

docs/api/_sources/changelog.md.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../CHANGELOG.md
1+
../CHANGELOG.md

0 commit comments

Comments
 (0)