-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
70 additions
and
734 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,87 +3,77 @@ on: | |
push: | ||
branches: | ||
- main | ||
# Remove line 61 to enable automated semantic version bumps. | ||
# Change line 67 from "if: false" to "if: true" to enable PyPI publishing. | ||
# Requires that svc-aindscicomp be added as an admin to repo. | ||
jobs: | ||
update_badges: | ||
tag: | ||
name: Bump version | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
outputs: | ||
new_version: ${{ steps.output_version.outputs.new_version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.DEFAULT_BRANCH }} | ||
ref: "main" | ||
fetch-depth: 0 | ||
token: ${{ secrets.SERVICE_TOKEN }} | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -e .[dev] --no-cache-dir | ||
- name: Get Python version and Update README.md | ||
run: | | ||
python_version=$(grep "requires-python" pyproject.toml | grep -o ">=[^\"]*") | ||
python_badge=$(grep -o 'python-[^)]*' README.md) | ||
new_python_badge="python-$python_version-blue?logo=python" | ||
sed -i "s/$python_badge/$new_python_badge/g" README.md | ||
- name: Get interrogate values and Update README.md | ||
run: | | ||
interrogate_val=$(interrogate . | grep -o 'actual: [0-9]*\.[0-9]*' | awk '{print $2}') | ||
interrogate_badge=$(grep -o 'interrogate-[^)]*' README.md) | ||
if (( $(echo "$interrogate_val >= 90.00" | bc -l) )); then | ||
new_interrogate_badge="interrogate-$interrogate_val%25-brightgreen" | ||
elif (( $(echo "$interrogate_val < 80.00" | bc -l) )); then | ||
new_interrogate_badge="interrogate-$interrogate_val%25-red" | ||
else | ||
new_interrogate_badge="interrogate-$interrogate_val%25-yellow" | ||
fi | ||
sed -i "s/$interrogate_badge/$new_interrogate_badge/g" README.md | ||
- name: Get Coverage values and Update README.md | ||
run: | | ||
coverage run -m unittest discover | ||
coverage_val=$(coverage report | grep "^TOTAL" | grep -o '[0-9]\+%' | grep -o '[0-9]\+') | ||
coverage_badge=$(grep -o "coverage-[^?]*" README.md) | ||
if (( $(echo "$coverage_val >= 90.00" | bc -l) )); then | ||
new_coverage_badge="coverage-$coverage_val%25-brightgreen" | ||
elif (( $(echo "$coverage_val < 80.00" | bc -l) )); then | ||
new_coverage_badge="coverage-$coverage_val%25-red" | ||
else | ||
new_coverage_badge="coverage-$coverage_val%25-yellow" | ||
fi | ||
sed -i "s/$coverage_badge/$new_coverage_badge/g" README.md | ||
- name: Commit changes | ||
uses: EndBug/add-and-commit@v9 | ||
- name: Compute new version number | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
default_author: github_actions | ||
message: "ci: update badges [skip actions]" | ||
add: '["README.md"]' | ||
tag: | ||
needs: update_badges | ||
if: ${{github.event.repository.name == 'aind-library-template'}} | ||
uses: AllenNeuralDynamics/aind-github-actions/.github/workflows/tag.yml@main | ||
secrets: | ||
SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }} | ||
github_token: ${{ secrets.SERVICE_TOKEN }} | ||
release_branches: "main" | ||
default_bump: patch | ||
dry_run: false | ||
publish: | ||
needs: tag | ||
if: false | ||
runs-on: ubuntu-latest | ||
env: | ||
GO_VERSION: '1.14.12' | ||
GO_OS: 'linux' | ||
GO_ARCH: 'amd64' | ||
SINGULARITY_VERSION: '3.7.0' | ||
needs: tag | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Pull latest changes | ||
run: git pull origin main | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade setuptools wheel twine build | ||
python -m build | ||
twine check dist/* | ||
- name: Publish on PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.AIND_PYPI_TOKEN }} | ||
sudo apt-get update && sudo apt-get install -y \ | ||
build-essential \ | ||
libssl-dev \ | ||
uuid-dev \ | ||
libgpgme11-dev \ | ||
squashfs-tools \ | ||
libseccomp-dev \ | ||
wget \ | ||
pkg-config \ | ||
procps | ||
- name: Install GO | ||
run: | | ||
wget https://dl.google.com/go/go$GO_VERSION.$GO_OS-$GO_ARCH.tar.gz | ||
sudo tar -C /usr/local -xzvf go$GO_VERSION.$GO_OS-$GO_ARCH.tar.gz | ||
sudo rm go$GO_VERSION.$GO_OS-$GO_ARCH.tar.gz | ||
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile | ||
- name: Install Singularity | ||
run: | | ||
cd .. | ||
wget https://github.com/hpcng/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-${SINGULARITY_VERSION}.tar.gz | ||
sudo tar -xzf singularity-${SINGULARITY_VERSION}.tar.gz | ||
sudo rm singularity-${SINGULARITY_VERSION}.tar.gz | ||
echo "Finished installing binaries" | ||
export PATH=$PATH:/usr/local/go/bin | ||
cd singularity | ||
sudo ./mconfig --without-suid | ||
sudo make -C ./builddir | ||
sudo make -C ./builddir install | ||
- name: Build sif container | ||
run: | | ||
ls / | ||
ls | ||
mkdir build | ||
sudo singularity build build/container.sif scripts/singularity_build.def | ||
- name: Login and Deploy Container | ||
run: | | ||
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io | ||
singularity push build/container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${{ needs.tag.outputs.new_version }} | ||
singularity push build/container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:latest |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,9 @@ | ||
# aind-data-upload | ||
|
||
Repository to manage uploading data to the cloud | ||
|
||
[![License](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE) | ||
![Code Style](https://img.shields.io/badge/code%20style-black-black) | ||
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release) | ||
![Interrogate](https://img.shields.io/badge/interrogate-100.0%25-brightgreen) | ||
![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen?logo=codecov) | ||
![Python](https://img.shields.io/badge/python->=3.7-blue?logo=python) | ||
|
||
|
||
|
||
## Usage | ||
- To use this template, click the green `Use this template` button and `Create new repository`. | ||
- After github initially creates the new repository, please wait an extra minute for the initialization scripts to finish organizing the repo. | ||
- To enable the automatic semantic version increments: in the repository go to `Settings` and `Collaborators and teams`. Click the green `Add people` button. Add `svc-aindscicomp` as an admin. Modify the file in `.github/workflows/tag_and_publish.yml` and remove the if statement in line 10. The semantic version will now be incremented every time a code is committed into the main branch. | ||
- To publish to PyPI, enable semantic versioning and uncomment the publish block in `.github/workflows/tag_and_publish.yml`. The code will now be published to PyPI every time the code is committed into the main branch. | ||
- The `.github/workflows/test_and_lint.yml` file will run automated tests and style checks every time a Pull Request is opened. If the checks are undesired, the `test_and_lint.yml` can be deleted. The strictness of the code coverage level, etc., can be modified by altering the configurations in the `pyproject.toml` file and the `.flake8` file. | ||
|
||
## Installation | ||
To use the software, in the root directory, run | ||
```bash | ||
pip install -e . | ||
``` | ||
|
||
To develop the code, run | ||
```bash | ||
pip install -e .[dev] | ||
``` | ||
|
||
## Contributing | ||
|
||
### Linters and testing | ||
|
||
There are several libraries used to run linters, check documentation, and run tests. | ||
|
||
- Please test your changes using the **coverage** library, which will run the tests and log a coverage report: | ||
|
||
```bash | ||
coverage run -m unittest discover && coverage report | ||
``` | ||
|
||
- Use **interrogate** to check that modules, methods, etc. have been documented thoroughly: | ||
|
||
```bash | ||
interrogate . | ||
``` | ||
|
||
- Use **flake8** to check that code is up to standards (no unused imports, etc.): | ||
```bash | ||
flake8 . | ||
``` | ||
|
||
- Use **black** to automatically format the code into PEP standards: | ||
```bash | ||
black . | ||
``` | ||
|
||
- Use **isort** to automatically sort import statements: | ||
```bash | ||
isort . | ||
``` | ||
|
||
### Pull requests | ||
|
||
For internal members, please create a branch. For external members, please fork the repository and open a pull request from the fork. We'll primarily use [Angular](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit) style for commit messages. Roughly, they should follow the pattern: | ||
```text | ||
<type>(<scope>): <short summary> | ||
``` | ||
|
||
where scope (optional) describes the packages affected by the code changes and type (mandatory) is one of: | ||
|
||
- **build**: Changes that affect build tools or external dependencies (example scopes: pyproject.toml, setup.py) | ||
- **ci**: Changes to our CI configuration files and scripts (examples: .github/workflows/ci.yml) | ||
- **docs**: Documentation only changes | ||
- **feat**: A new feature | ||
- **fix**: A bugfix | ||
- **perf**: A code change that improves performance | ||
- **refactor**: A code change that neither fixes a bug nor adds a feature | ||
- **test**: Adding missing tests or correcting existing tests | ||
|
||
### Semantic Release | ||
|
||
The table below, from [semantic release](https://github.com/semantic-release/semantic-release), shows which commit message gets you which release type when `semantic-release` runs (using the default configuration): | ||
|
||
| Commit message | Release type | | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | | ||
| `fix(pencil): stop graphite breaking when too much pressure applied` | ~~Patch~~ Fix Release, Default release | | ||
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release | | ||
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release <br /> (Note that the `BREAKING CHANGE: ` token must be in the footer of the commit) | | ||
|
||
### Documentation | ||
To generate the rst files source files for documentation, run | ||
```bash | ||
sphinx-apidoc -o doc_template/source/ src | ||
``` | ||
Then to create the documentation HTML files, run | ||
```bash | ||
sphinx-build -b html doc_template/source/ doc_template/build/html | ||
``` | ||
More info on sphinx installation can be found [here](https://www.sphinx-doc.org/en/master/usage/installation.html). | ||
We can add additional python if needed. For now, this will publish a singularity container with `awscli` installed. Most jobs will just use the sync command. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.