Skip to content

Commit

Permalink
Add test file for gha
Browse files Browse the repository at this point in the history
  • Loading branch information
roceb committed Nov 19, 2024
1 parent 77ae50b commit fdc0c3f
Show file tree
Hide file tree
Showing 3 changed files with 305 additions and 41 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
266 changes: 266 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
name: Build

Check warning on line 1 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

3:1 [truthy] truthy value should be one of [false, true]
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.7
- 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

Check failure on line 60 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

60:81 [line-length] line too long (85 > 80 characters)
# 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 '[email protected]' \
--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

Check failure on line 79 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

79:81 [line-length] line too long (85 > 80 characters)
# an rcX eups tag. This validates the location of the git tags but

Check failure on line 80 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

80:81 [line-length] line too long (83 > 80 characters)
# 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 '[email protected]' \
--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

Check failure on line 101 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

101:81 [line-length] line too long (83 > 80 characters)
# manifest it was based on and the eups tag, the eups product version

Check failure on line 102 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

102:81 [line-length] line too long (85 > 80 characters)
# 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 '[email protected]' \
--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 '[email protected]' \
--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 '[email protected]' \
--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 '[email protected]' \
--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
[[ $? == 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

Check failure on line 247 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

247:81 [line-length] line too long (87 > 80 characters)
environment:
name: pypi
url: https://pypi.org/p/<your-pypi-project-name>
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

Check failure on line 266 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / call-workflow / yamllint

266:1 [empty-lines] too many blank lines (1 > 0)
79 changes: 39 additions & 40 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'
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 = "[email protected]"
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,
Expand All @@ -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>=3.7.7,<3.8",
"pytest>=4.3,<5",
"pytest-flake8>=1.0.4,<2",
"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",
]
}
},
)

0 comments on commit fdc0c3f

Please sign in to comment.