From bc0438121b43582a92ef9eedc2e11d3d763c8245 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Thu, 14 Nov 2024 16:29:31 -0500 Subject: [PATCH 1/4] Add GHA docker build --- .github/workflows/build.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..dc195a5 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,22 @@ +name: Build + +on: + push: + branches: + - main + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build and push + uses: lsst-dm/build-and-push@main + id: build + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: docker/Dockerfile + platforms: linux/amd64,linux/arm64 + image: ${{ github.repository }} + push: true From 77ae50bc34e2b3620b9ef9d8bc4f9ba7887051a8 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Thu, 14 Nov 2024 23:54:05 -0500 Subject: [PATCH 2/4] Add default github action --- .github/workflows/build.yaml | 2 ++ .github/workflows/markdownlint.yaml | 12 ++++++++++++ .github/workflows/rebase_checker.yaml | 8 ++++++++ .github/workflows/yamllint.yaml | 12 ++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 .github/workflows/markdownlint.yaml create mode 100644 .github/workflows/rebase_checker.yaml create mode 100644 .github/workflows/yamllint.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dc195a5..7a3af42 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + pull_request: jobs: docker: @@ -16,6 +17,7 @@ jobs: id: build with: github_token: ${{ secrets.GITHUB_TOKEN }} + docker_token: ${{ secrets.DOCKER_TOKEN }} dockerfile: docker/Dockerfile platforms: linux/amd64,linux/arm64 image: ${{ github.repository }} diff --git a/.github/workflows/markdownlint.yaml b/.github/workflows/markdownlint.yaml new file mode 100644 index 0000000..e6685c0 --- /dev/null +++ b/.github/workflows/markdownlint.yaml @@ -0,0 +1,12 @@ +--- +name: Lint Markdown Files + +on: + push: + branches: + - main + pull_request: + +jobs: + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/markdownlint.yaml@main diff --git a/.github/workflows/rebase_checker.yaml b/.github/workflows/rebase_checker.yaml new file mode 100644 index 0000000..62aeca7 --- /dev/null +++ b/.github/workflows/rebase_checker.yaml @@ -0,0 +1,8 @@ +--- +name: Check that 'main' is not merged into the development branch + +on: pull_request + +jobs: + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/rebase_checker.yaml@main diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 0000000..aec968a --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,12 @@ +--- +name: Lint YAML Files + +on: + push: + branches: + - main + pull_request: + +jobs: + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/yamllint.yaml@main From a7a26779d6e5b1d82c96de3ce2d0ec0103c33891 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Tue, 19 Nov 2024 15:24:42 -0500 Subject: [PATCH 3/4] Add test file for gha --- .github/workflows/build.yaml | 1 - .github/workflows/test.yaml | 266 +++++++++++++++++++++++++++++++++++ setup.cfg | 2 +- setup.py | 79 +++++------ 4 files changed, 306 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7a3af42..c3c8bd8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,7 +17,6 @@ jobs: id: build with: github_token: ${{ secrets.GITHUB_TOKEN }} - docker_token: ${{ secrets.DOCKER_TOKEN }} dockerfile: docker/Dockerfile platforms: linux/amd64,linux/arm64 image: ${{ github.repository }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..e655610 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,266 @@ +name: Test + +on: + push: + branches: + - main + tags: + pull_request: + +jobs: + tests: + strategy: + matrix: + include: + - test: pytest + - test: github-tag-release + - test: github-tag-teams + - test: github-decimate-org + - test: github-fork-org + - test: github-get-ratelimit + - test: github-auth + - test: github-list-repos + - test: github-mv-repos-to-team + - test: github-auth-debug + env: + DM_SQUARE_DEBUG: 'bogus_non_int_able_value' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install deps + run: | + pip install --upgrade pip setuptools_scm 'setuptools==58' + #if [ "${{ matrix.test }}" == "github-tag-release" ]; then + python setup.py sdist + pip install dist/sqre-codekit-*.tar.gz + #fi + - name: Run Tests + env: + SQREADMIN_TOKEN: ${{ secrets.SQREADMIN_TOKEN }} + DM_SQUARE_DEBUG: ${{ matrix.env.DM_SQUARE_DEBUG || '' }} + run: | + set -e + TEST=${{ matrix.test }} + case "$TEST" in + pytest) + python setup.py test + ;; + + github-tag-release) + set -e + # check argparse help formatting for errors + "$TEST" -h + + if [ -n "$SQREADMIN_TOKEN" ]; then + # verify a past weekly tag -- the eups tag name and git tag names are + # in sync except for s/_/-/ + "$TEST" \ + --verify \ + --debug \ + --limit 10 \ + --org 'lsst' \ + --allow-team 'Data Management' \ + --allow-team 'DM Externals' \ + --external-team 'DM Externals' \ + --deny-team 'DM Auxilliaries' \ + --email 'sqre-admin@lists.lsst.org' \ + --user 'sqreadmin' \ + --token "$SQREADMIN_TOKEN" \ + --ignore-git-tagger \ + --ignore-git-message \ + --manifest 'b3595' \ + 'w.2018.18' + + # verify a past official release where the git tag was generated from + # an rcX eups tag. This validates the location of the git tags but + # does not inspect the official eups release tag at all. + "$TEST" \ + --verify \ + --debug \ + --limit 10 \ + --org 'lsst' \ + --allow-team 'Data Management' \ + --allow-team 'DM Externals' \ + --external-team 'DM Externals' \ + --deny-team 'DM Auxilliaries' \ + --email 'sqre-admin@lists.lsst.org' \ + --user 'sqreadmin' \ + --token "$SQREADMIN_TOKEN" \ + --ignore-git-tagger \ + --ignore-git-message \ + --eups-tag 'v15_0_rc3' \ + --manifest 'b3504' \ + '15.0' + + # verify a past official release using the eups tag. As the eups + # product version strings will be out of sync between the versiondb + # manifest it was based on and the eups tag, the eups product version + # strings have to be ignored. + "$TEST" \ + --verify \ + --debug \ + --limit 10 \ + --org 'lsst' \ + --allow-team 'Data Management' \ + --allow-team 'DM Externals' \ + --external-team 'DM Externals' \ + --deny-team 'DM Auxilliaries' \ + --email 'sqre-admin@lists.lsst.org' \ + --user 'sqreadmin' \ + --token "$SQREADMIN_TOKEN" \ + --ignore-manifest-versions \ + --ignore-git-tagger \ + --ignore-git-message \ + --manifest 'b3504' \ + '15.0' + + "$TEST" \ + --dry-run \ + --debug \ + --limit 10 \ + --org 'lsst' \ + --allow-team 'Data Management' \ + --allow-team 'DM Externals' \ + --external-team 'DM Externals' \ + --deny-team 'DM Auxilliaries' \ + --email 'sqre-admin@lists.lsst.org' \ + --user 'sqreadmin' \ + --token "$SQREADMIN_TOKEN" \ + --ignore-manifest-versions \ + --ignore-git-tagger \ + --ignore-git-message \ + --manifest 'b3595' \ + --manifest-only \ + 'w.2018.18' + else + echo "Unable to test without secure env vars." + fi + ;; + + github-tag-teams) + "$TEST" -h + if [ -n "$SQREADMIN_TOKEN" ]; then + # check argparse help formatting for errors + # create + "$TEST" \ + --debug \ + --dry-run \ + --org 'lsst' \ + --allow-team 'DM Auxilliaries' \ + --deny-team 'DM Externals' \ + --token "$SQREADMIN_TOKEN" \ + --user 'sqreadmin' \ + --email 'sqre-admin@lists.lsst.org' \ + --tag 'foo' \ + --tag 'bar' + + # --delete + "$TEST" \ + --debug \ + --dry-run \ + --delete \ + --org 'lsst' \ + --allow-team 'DM Auxilliaries' \ + --deny-team 'DM Externals' \ + --token "$SQREADMIN_TOKEN" \ + --user 'sqreadmin' \ + --email 'sqre-admin@lists.lsst.org' \ + --tag 'foo' \ + --tag 'bar' + else + echo "Unable to test without travis secure env vars." + fi + ;; + + github-decimate-org) + "$TEST" -h + if [ -n "$SQREADMIN_TOKEN" ]; then + "$TEST" \ + --dry-run \ + --debug \ + --org 'batmanuel-sandbox' \ + --token "$SQREADMIN_TOKEN" \ + --delete-repos \ + --delete-repos-limit 3 \ + --delete-teams \ + --delete-teams-limit 3 + else + echo "Unable to test without travis secure env vars." + fi + ;; + + github-fork-org) + # check argparse help formatting for errors + "$TEST" -h + if [ -n "$SQREADMIN_TOKEN" ]; then + "$TEST" \ + --dry-run \ + --debug \ + --src-org 'lsst' \ + --dst-org 'batmanuel-sandbox' \ + --token "$SQREADMIN_TOKEN" \ + --team 'DM Auxilliaries' \ + --team 'DM Externals' \ + --team 'Data Management' \ + --limit 10 + #--copy-teams + else + echo "Unable to test without travis secure env vars." + fi + ;; + + github-get-ratelimit) + # check argparse help formatting for errors + "$TEST" -h + + if [ -n "$SQREADMIN_TOKEN" ]; then + "$TEST" \ + --debug \ + --token "$SQREADMIN_TOKEN" + else + echo "le to test without travis secure env vars." + fi + ;; + + github-auth-debug) + TEST=github-auth + # should fail + "$TEST" -u foo || true + #[[ $? == 1 ]] + ;; + *) + "$TEST" -h + ;; + + esac + publish: + needs: tests + name: Upload release to PyPI + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-20.04 + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + environment: + name: pypi + url: https://pypi.org/p/ + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.6' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install setuptools wheel twine + - name: Build + run: | + python setup.py sdist bdist_wheel + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + diff --git a/setup.cfg b/setup.cfg index 59175b7..cb9394e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ test=pytest [tool:pytest] -addopts = --flake8 +#addopts = --flake8 [flake8] ignore=E722,W504 diff --git a/setup.py b/setup.py index 25aa625..5418abe 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,25 @@ #!/usr/bin/env python3 """Setup Tools Script""" -import os import codecs -from setuptools import setup, find_packages +import os + +from setuptools import find_packages, setup -PACKAGENAME = 'sqre-codekit' -DESCRIPTION = 'LSST Data Management SQuaRE code management tools' -AUTHOR = 'Frossie Economou' -AUTHOR_EMAIL = 'frossie@lsst.org' -URL = 'https://github.com/lsst-sqre/sqre-codekit' -LICENSE = 'MIT' +PACKAGENAME = "sqre-codekit" +DESCRIPTION = "LSST Data Management SQuaRE code management tools" +AUTHOR = "Frossie Economou" +AUTHOR_EMAIL = "frossie@lsst.org" +URL = "https://github.com/lsst-sqre/sqre-codekit" +LICENSE = "MIT" def read(filename): """Convenience function for includes""" - full_filename = os.path.join( - os.path.abspath(os.path.dirname(__file__)), - filename) - return codecs.open(full_filename, 'r', 'utf-8').read() + full_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename) + return codecs.open(full_filename, "r", "utf-8").read() -long_description = read('README.md') # pylint:disable=invalid-name +long_description = read("README.md") # pylint:disable=invalid-name setup( name=PACKAGENAME, @@ -32,42 +31,42 @@ def read(filename): author_email=AUTHOR_EMAIL, license=LICENSE, classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python :: 3.6', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Programming Language :: Python :: 3.6", + "License :: OSI Approved :: MIT License", ], - keywords='lsst', + keywords="lsst", use_scm_version=True, - packages=find_packages(exclude=['docs', 'tests*']), + packages=find_packages(exclude=["docs", "tests*"]), install_requires=[ - 'MapGitConfig==1.1', - 'progressbar2==3.37.1', - 'public==1.0', - 'pygithub==1.40a3', - 'pyyaml>=5.1', - 'requests>=2.8.1,<3.0.0', + "MapGitConfig==1.1", + "progressbar2==3.37.1", + "public==1.0", + "pygithub==1.59", + "pyyaml>=5.1", + "requests>=2.8.1,<3.0.0", ], setup_requires=[ - 'pytest-runner>=4.4,<5', - 'setuptools_scm', + "pytest-runner>=4.4,<5", + "setuptools_scm", ], tests_require=[ - 'flake8>=3.7.7,<3.8', - 'pytest>=4.3,<5', - 'pytest-flake8>=1.0.4,<2', - 'responses>=0.9.0,<1', + "flake8", + "pytest<5", + # "pytest-flake8", + "responses>=0.9.0,<1", ], # package_data={}, entry_points={ - 'console_scripts': [ - 'github-auth = codekit.cli.github_auth:main', - 'github-decimate-org = codekit.cli.github_decimate_org:main', - 'github-fork-org = codekit.cli.github_fork_org:main', - 'github-get-ratelimit= codekit.cli.github_get_ratelimit:main', - 'github-list-repos = codekit.cli.github_list_repos:main', - 'github-mv-repos-to-team = codekit.cli.github_mv_repos_to_team:main', # NOQA - 'github-tag-release = codekit.cli.github_tag_release:main', - 'github-tag-teams = codekit.cli.github_tag_teams:main', + "console_scripts": [ + "github-auth = codekit.cli.github_auth:main", + "github-decimate-org = codekit.cli.github_decimate_org:main", + "github-fork-org = codekit.cli.github_fork_org:main", + "github-get-ratelimit= codekit.cli.github_get_ratelimit:main", + "github-list-repos = codekit.cli.github_list_repos:main", + "github-mv-repos-to-team = codekit.cli.github_mv_repos_to_team:main", # NOQA + "github-tag-release = codekit.cli.github_tag_release:main", + "github-tag-teams = codekit.cli.github_tag_teams:main", ] - } + }, ) From f21b4b7abb1ae409da4a5dea1f08257bfaa92b13 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Tue, 19 Nov 2024 17:40:02 -0500 Subject: [PATCH 4/4] remove travis files --- .github/workflows/test.yaml | 1 - .hadolint.yaml | 4 - .travis.yml | 315 ------------------------------------ .yamllint.yaml | 12 ++ setup.py | 69 ++++---- tests/hadolint.sh | 28 ---- tests/make.sh | 31 ---- tests/shellcheck.sh | 26 --- tests/yamllint.sh | 34 ---- 9 files changed, 47 insertions(+), 473 deletions(-) delete mode 100644 .hadolint.yaml delete mode 100644 .travis.yml create mode 100644 .yamllint.yaml delete mode 100755 tests/hadolint.sh delete mode 100755 tests/make.sh delete mode 100755 tests/shellcheck.sh delete mode 100755 tests/yamllint.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e655610..ec2e21d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -263,4 +263,3 @@ jobs: python setup.py sdist bdist_wheel - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - diff --git a/.hadolint.yaml b/.hadolint.yaml deleted file mode 100644 index fa6a117..0000000 --- a/.hadolint.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -ignored: - # disable USER root - - DL3002 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 65b89e8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,315 +0,0 @@ ---- -# yamllint disable rule:line-length -sudo: false -matrix: - include: - - env: TEST='pytest' - language: python - python: &pyver '3.6' - install: pip install --upgrade 'pip>=9' setuptools_scm - script: python setup.py test - - - env: TEST='github-tag-release' - language: python - python: *pyver - install: &codekit_install - - pip install --upgrade 'pip>=9' setuptools_scm - - python setup.py sdist - - pip install dist/sqre-codekit-*.tar.gz - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then - # verify a past weekly tag -- the eups tag name and git tag names are - # in sync except for s/_/-/ - "$TEST" \ - --verify \ - --debug \ - --limit 10 \ - --org 'lsst' \ - --allow-team 'Data Management' \ - --allow-team 'DM Externals' \ - --external-team 'DM Externals' \ - --deny-team 'DM Auxilliaries' \ - --email 'sqre-admin@lists.lsst.org' \ - --user 'sqreadmin' \ - --token "$SQREADMIN_TOKEN" \ - --ignore-git-tagger \ - --ignore-git-message \ - --manifest 'b3595' \ - 'w.2018.18' - - # verify a past official release where the git tag was generated from - # an rcX eups tag. This validates the location of the git tags but - # does not inspect the official eups release tag at all. - "$TEST" \ - --verify \ - --debug \ - --limit 10 \ - --org 'lsst' \ - --allow-team 'Data Management' \ - --allow-team 'DM Externals' \ - --external-team 'DM Externals' \ - --deny-team 'DM Auxilliaries' \ - --email 'sqre-admin@lists.lsst.org' \ - --user 'sqreadmin' \ - --token "$SQREADMIN_TOKEN" \ - --ignore-git-tagger \ - --ignore-git-message \ - --eups-tag 'v15_0_rc3' \ - --manifest 'b3504' \ - '15.0' - - # verify a past official release using the eups tag. As the eups - # product version strings will be out of sync between the versiondb - # manifest it was based on and the eups tag, the eups product version - # strings have to be ignored. - "$TEST" \ - --verify \ - --debug \ - --limit 10 \ - --org 'lsst' \ - --allow-team 'Data Management' \ - --allow-team 'DM Externals' \ - --external-team 'DM Externals' \ - --deny-team 'DM Auxilliaries' \ - --email 'sqre-admin@lists.lsst.org' \ - --user 'sqreadmin' \ - --token "$SQREADMIN_TOKEN" \ - --ignore-manifest-versions \ - --ignore-git-tagger \ - --ignore-git-message \ - --manifest 'b3504' \ - '15.0' - - "$TEST" \ - --dry-run \ - --debug \ - --limit 10 \ - --org 'lsst' \ - --allow-team 'Data Management' \ - --allow-team 'DM Externals' \ - --external-team 'DM Externals' \ - --deny-team 'DM Auxilliaries' \ - --email 'sqre-admin@lists.lsst.org' \ - --user 'sqreadmin' \ - --token "$SQREADMIN_TOKEN" \ - --ignore-manifest-versions \ - --ignore-git-tagger \ - --ignore-git-message \ - --manifest 'b3595' \ - --manifest-only \ - 'w.2018.18' - else - echo "Unable to test without travis secure env vars." - fi - - - env: TEST='github-tag-teams' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then - # create - "$TEST" \ - --debug \ - --dry-run \ - --org 'lsst' \ - --allow-team 'DM Auxilliaries' \ - --deny-team 'DM Externals' \ - --token "$SQREADMIN_TOKEN" \ - --user 'sqreadmin' \ - --email 'sqre-admin@lists.lsst.org' \ - --tag 'foo' \ - --tag 'bar' - - # --delete - "$TEST" \ - --debug \ - --dry-run \ - --delete \ - --org 'lsst' \ - --allow-team 'DM Auxilliaries' \ - --deny-team 'DM Externals' \ - --token "$SQREADMIN_TOKEN" \ - --user 'sqreadmin' \ - --email 'sqre-admin@lists.lsst.org' \ - --tag 'foo' \ - --tag 'bar' - else - echo "Unable to test without travis secure env vars." - fi - - - env: TEST='github-decimate-org' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then - "$TEST" \ - --dry-run \ - --debug \ - --org 'batmanuel-sandbox' \ - --token "$SQREADMIN_TOKEN" \ - --delete-repos \ - --delete-repos-limit 3 \ - --delete-teams \ - --delete-teams-limit 3 - else - echo "Unable to test without travis secure env vars." - fi - - - env: TEST='github-fork-org' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then - "$TEST" \ - --dry-run \ - --debug \ - --src-org 'lsst' \ - --dst-org 'batmanuel-sandbox' \ - --token "$SQREADMIN_TOKEN" \ - --team 'DM Auxilliaries' \ - --team 'DM Externals' \ - --team 'Data Management' \ - --limit 10 - #--copy-teams - else - echo "Unable to test without travis secure env vars." - fi - - - env: TEST='github-get-ratelimit' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then - "$TEST" \ - --debug \ - --token "$SQREADMIN_TOKEN" - else - echo "Unable to test without travis secure env vars." - fi - - - env: TEST='github-auth' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - - env: TEST='github-list-repos' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - - env: TEST='github-mv-repos-to-team' - language: python - python: *pyver - install: *codekit_install - script: | - set -e - - # check argparse help formatting for errors - "$TEST" -h - - - env: - TEST='github-auth' - DM_SQUARE_DEBUG='bogus_non_int_able_value' - language: python - python: *pyver - install: *codekit_install - script: | - # should fail - "$TEST" -u foo - [[ $? == 1 ]] - - - env: TEST=markdownlint - language: c - services: - - docker - script: ./tests/mdl.sh - - - env: TEST=make - language: c - script: ./tests/make.sh - - - env: TEST=hadolint - language: c - services: - - docker - script: ./tests/hadolint.sh - - - env: TEST=yamllint - language: c - services: - - docker - script: ./tests/yamllint.sh - - - env: TEST=shellcheck - language: c - services: - - docker - script: ./tests/shellcheck.sh - - - stage: pypi release - if: (NOT type IN (pull_request)) AND (tag IS present) - language: python - python: &pyver '3.6' - install: *codekit_install - script: skip - deploy: - provider: pypi - user: sqre-admin - skip_upload_docs: true - distributions: sdist bdist_wheel - password: - secure: f88F6UgUAxe73pQuX5yGHdl96e/dcQIFClBc6mNgzAVDjxWXskQ/YRCcbO81yxdjsQRfBJsOiiQKcuM76k1iaOQTazQtdG2Wc/S29qzLlReBNTvo4iMBTg1TDSkT5RnDKrxG4omphlgJP2C9i+b0TjDcKJ26uh8t6m6eUs/Mffw= - # yamllint disable-line rule:truthy - on: - tags: true - branch: master - repo: lsst-sqre/sqre-codekit -env: - global: - - secure: WEvb3zfO3XL0vUqIyckr3qZ7RWP5Iw9Pxbgw2Ei8tB8FSqz5DzU99xwl+ucTDQXIGYs4M1ROnf0hpCPP9OM0eSZaRPTf8BEK0SNjDEIQO4Rc89dskNqhf1CFQnCauJhk2ZJ/q0i4J9dV/igN6Ub/3kMRHov6i1UTfqs6ixfo3Fg= -branches: - only: - - master - # also matched against tag pushes - - /^\d+\.\d+\.\d+$/ -notifications: - email: false diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..c5b3fd2 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,12 @@ +--- +extends: default + +rules: + # 80 chars should be enough, but don't fail if a line is longer + document-start: + ignore: | + /.github/workflows/ + line-length: disable + truthy: + ignore: | + /.github/workflows/ diff --git a/setup.py b/setup.py index 5418abe..14ac939 100644 --- a/setup.py +++ b/setup.py @@ -5,21 +5,21 @@ from setuptools import find_packages, setup -PACKAGENAME = "sqre-codekit" -DESCRIPTION = "LSST Data Management SQuaRE code management tools" -AUTHOR = "Frossie Economou" -AUTHOR_EMAIL = "frossie@lsst.org" -URL = "https://github.com/lsst-sqre/sqre-codekit" -LICENSE = "MIT" +PACKAGENAME = 'sqre-codekit' +DESCRIPTION = 'LSST Data Management SQuaRE code management tools' +AUTHOR = 'Frossie Economou' +AUTHOR_EMAIL = 'frossie@lsst.org' +URL = 'https://github.com/lsst-sqre/sqre-codekit' +LICENSE = 'MIT' def read(filename): """Convenience function for includes""" full_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename) - return codecs.open(full_filename, "r", "utf-8").read() + return codecs.open(full_filename, 'r', 'utf-8').read() -long_description = read("README.md") # pylint:disable=invalid-name +long_description = read('README.md') # pylint:disable=invalid-name setup( name=PACKAGENAME, @@ -31,42 +31,43 @@ def read(filename): author_email=AUTHOR_EMAIL, license=LICENSE, classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python :: 3.6", - "License :: OSI Approved :: MIT License", + 'Development Status :: 4 - Beta', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', ], - keywords="lsst", + keywords='lsst', use_scm_version=True, - packages=find_packages(exclude=["docs", "tests*"]), + packages=find_packages(exclude=['docs', 'tests*']), install_requires=[ - "MapGitConfig==1.1", - "progressbar2==3.37.1", - "public==1.0", - "pygithub==1.59", - "pyyaml>=5.1", - "requests>=2.8.1,<3.0.0", + 'MapGitConfig==1.1', + 'progressbar2==3.37.1', + 'public==1.0', + 'pygithub==1.59', + 'pyyaml>=5.1', + 'requests>=2.8.1,<3.0.0', ], setup_requires=[ - "pytest-runner>=4.4,<5", - "setuptools_scm", + 'pytest-runner>=4.4,<5', + 'setuptools_scm', ], tests_require=[ - "flake8", - "pytest<5", - # "pytest-flake8", - "responses>=0.9.0,<1", + 'flake8', + 'pytest<5', + # Removed due to incompatibility + # 'pytest-flake8', + 'responses>=0.9.0,<1', ], # package_data={}, entry_points={ - "console_scripts": [ - "github-auth = codekit.cli.github_auth:main", - "github-decimate-org = codekit.cli.github_decimate_org:main", - "github-fork-org = codekit.cli.github_fork_org:main", - "github-get-ratelimit= codekit.cli.github_get_ratelimit:main", - "github-list-repos = codekit.cli.github_list_repos:main", - "github-mv-repos-to-team = codekit.cli.github_mv_repos_to_team:main", # NOQA - "github-tag-release = codekit.cli.github_tag_release:main", - "github-tag-teams = codekit.cli.github_tag_teams:main", + 'console_scripts': [ + 'github-auth = codekit.cli.github_auth:main', + 'github-decimate-org = codekit.cli.github_decimate_org:main', + 'github-fork-org = codekit.cli.github_fork_org:main', + 'github-get-ratelimit= codekit.cli.github_get_ratelimit:main', + 'github-list-repos = codekit.cli.github_list_repos:main', + 'github-mv-repos-to-team = codekit.cli.github_mv_repos_to_team:main', # NOQA + 'github-tag-release = codekit.cli.github_tag_release:main', + 'github-tag-teams = codekit.cli.github_tag_teams:main', ] }, ) diff --git a/tests/hadolint.sh b/tests/hadolint.sh deleted file mode 100755 index 0e9d003..0000000 --- a/tests/hadolint.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/Dockerfile ) -IGNORE=() - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -for f in "${CHECK[@]}"; do - docker run -ti -v "$(pwd):$(pwd)" -w "$(pwd)" \ - hadolint/hadolint hadolint "$f" -done - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/make.sh b/tests/make.sh deleted file mode 100755 index 341d206..0000000 --- a/tests/make.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/Makefile ) -IGNORE=() - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -for f in "${CHECK[@]}"; do - ( set -e - cd "$(dirname "$f")" - echo "checking $f" - make --dry-run --warn-undefined-variables - ) -done - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh deleted file mode 100755 index 7ef6b83..0000000 --- a/tests/shellcheck.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/*.sh ) -IGNORE=() - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -docker run -ti -v "$(pwd):$(pwd)" -w "$(pwd)" \ - koalaman/shellcheck-alpine:v0.4.6 -x "${CHECK[@]}" - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/yamllint.sh b/tests/yamllint.sh deleted file mode 100755 index 5fa84a6..0000000 --- a/tests/yamllint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/*.yaml **/*.yml **/*.eyaml .travis.yml ) -EYAML=( **/*.eyaml ) -IGNORE=() - -# filter out plaintext versions of .eyaml files -for e in "${!EYAML[@]}"; do - uneyaml=${EYAML[e]/eyaml/yaml} - for c in "${!CHECK[@]}"; do - [[ ${CHECK[c]} == "$uneyaml" ]] && unset -v 'CHECK[c]' - done -done - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -docker run -ti -v "$(pwd):/workdir" lsstsqre/yamllint:1.11.1 "${CHECK[@]}" - -# vim: tabstop=2 shiftwidth=2 expandtab