Skip to content

Commit

Permalink
Merge pull request #11 from Erotemic/dev/2.2.2
Browse files Browse the repository at this point in the history
Remove codecov from tests
  • Loading branch information
Erotemic authored May 22, 2023
2 parents e7ba148 + 69194c1 commit e812752
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 98 deletions.
95 changes: 55 additions & 40 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11 for linting
uses: actions/[email protected]
with:
python-version: 3.8
python-version: '3.11'
- name: Install dependencies
run: |-
python -m pip install --upgrade pip
Expand All @@ -29,15 +29,15 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 ./vtool_ibeis --count --select=E9,F63,F7,F82 --show-source --statistics
build_and_test_sdist:
name: Test sdist Python 3.8
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/[email protected]
with:
python-version: 3.8
python-version: '3.11'
- name: Upgrade pip
run: |-
python -m pip install --upgrade pip
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Install sdist
run: |-
ls -al ./wheelhouse
pip install wheelhouse/vtool_ibeis*.tar.gz -v
pip install --prefer-binary wheelhouse/vtool_ibeis*.tar.gz -v
- name: Test minimal loose sdist
run: |-
pwd
Expand Down Expand Up @@ -114,8 +114,7 @@ jobs:
- name: Build pure wheel
shell: bash
run: |-
python -m pip install pip -U
python -m pip install setuptools>=0.8 build
python -m pip install setuptools>=0.8 wheel build
python -m build --wheel --outdir wheelhouse
- name: Show built files
shell: bash
Expand All @@ -134,32 +133,32 @@ jobs:
matrix:
include:
- python-version: '3.7'
os: ubuntu-latest
install-extras: tests-strict,runtime-strict,headless-strict
os: ubuntu-latest
arch: auto
- python-version: '3.11'
os: ubuntu-latest
install-extras: tests-strict,runtime-strict,optional-strict,headless-strict
os: ubuntu-latest
arch: auto
- python-version: '3.7'
os: ubuntu-latest
install-extras: tests,optional,headless
os: ubuntu-latest
arch: auto
- python-version: '3.8'
os: ubuntu-latest
install-extras: tests,optional,headless
os: ubuntu-latest
arch: auto
- python-version: '3.9'
os: ubuntu-latest
install-extras: tests,optional,headless
os: ubuntu-latest
arch: auto
- python-version: '3.10'
os: ubuntu-latest
install-extras: tests,optional,headless
os: ubuntu-latest
arch: auto
- python-version: '3.11'
os: ubuntu-latest
install-extras: tests,optional,headless
os: ubuntu-latest
arch: auto
steps:
- name: Checkout source
Expand All @@ -174,57 +173,73 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
name: Download wheels and sdist
name: Download wheels
with:
name: wheels
path: wheelhouse
- name: Test wheel with ${{ matrix.install-extras }}
- name: Install wheel ${{ matrix.install-extras }}
shell: bash
env:
INSTALL_EXTRAS: ${{ matrix.install-extras }}
CI_PYTHON_VERSION: py${{ matrix.python-version }}
run: |-
# Find the path to the wheel
ls wheelhouse
echo "Finding the path to the wheel"
ls wheelhouse || echo "wheelhouse does not exist"
echo "Installing helpers"
pip install setuptools>=0.8 setuptools_scm wheel build -U
pip install tomli pkginfo
MOD_NAME=vtool_ibeis
echo "MOD_NAME=$MOD_NAME"
WHEEL_FPATH=$(python -c "import pathlib; print(str(sorted(pathlib.Path('wheelhouse').glob('$MOD_NAME*.whl'))[-1]).replace(chr(92), chr(47)))")
echo "WHEEL_FPATH=$WHEEL_FPATH"
MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
echo "MOD_VERSION=$MOD_VERSION"
# Install the wheel (ensure we are using the version we just built)
# NOTE: THE VERSION MUST BE NEWER THAN AN EXISTING PYPI VERSION OR THIS MAY FAIL
pip install --prefer-binary "$MOD_NAME[$INSTALL_EXTRAS]==$MOD_VERSION" -f wheelhouse
# Create a sandboxed directory
WORKSPACE_DNAME="testdir_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}"
export WHEEL_FPATH=$(python -c "import pathlib; print(str(sorted(pathlib.Path('wheelhouse').glob('vtool_ibeis*.whl'))[-1]).replace(chr(92), chr(47)))")
export MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
pip install --prefer-binary "vtool_ibeis[$INSTALL_EXTRAS]==$MOD_VERSION" -f wheelhouse
echo "Install finished."
- name: Test wheel ${{ matrix.install-extras }}
shell: bash
env:
CI_PYTHON_VERSION: py${{ matrix.python-version }}
run: |-
echo "Creating test sandbox directory"
export WORKSPACE_DNAME="testdir_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}"
echo "WORKSPACE_DNAME=$WORKSPACE_DNAME"
mkdir -p $WORKSPACE_DNAME
echo "cd-ing into the workspace"
cd $WORKSPACE_DNAME
pwd
ls -altr
# Get the path to the installed package and run the tests
MOD_DPATH=$(python -c "import vtool_ibeis, os; print(os.path.dirname(vtool_ibeis.__file__))")
echo "MOD_DPATH = $MOD_DPATH"
python -m pytest -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --cov="$MOD_NAME" "$MOD_DPATH" ../tests
export MOD_DPATH=$(python -c "import vtool_ibeis, os; print(os.path.dirname(vtool_ibeis.__file__))")
echo "
---
MOD_DPATH = $MOD_DPATH
---
running the pytest command inside the workspace
---
"
python -m pytest -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --cov="vtool_ibeis" "$MOD_DPATH" ../tests
echo "pytest command finished, moving the coverage file to the repo root"
ls -al
# Move coverage file to a new name
mv .coverage "../.coverage.$WORKSPACE_DNAME"
echo "changing directory back to th repo root"
cd ..
ls -al
- name: Combine coverage Linux
if: runner.os == 'Linux'
run: |-
echo '############ PWD'
pwd
cp .wheelhouse/.coverage* . || true
ls -al
python -m pip install coverage[toml]
echo '############ combine'
coverage combine .
coverage combine . || true
echo '############ XML'
coverage xml -o ./tests/coverage.xml
echo '############ FIND'
find . -name .coverage.*
find . -name coverage.xml
coverage xml -o ./coverage.xml || true
echo '### The cwd should now have a coverage.xml'
ls -altr
pwd
- uses: codecov/codecov-action@v3
name: Codecov Upload
with:
file: ./tests/coverage.xml
file: ./coverage.xml
test_deploy:
name: Uploading Test to PyPi
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ We are currently working on porting this changelog to the specifications in
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


### [Version 2.2.3] - Released 202x-xx-xx

### Fixed:
* Removed codecov from test requirements

### [Version 2.2.1] - Released 2023-01-29

### Fixed:
Expand Down
56 changes: 28 additions & 28 deletions dev/setup_secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ following CI platforms is used:
GITHUB ACTION INSTRUCTIONS
=========================
* `PERSONAL_GITHUB_PUSH_TOKEN` -
* `PERSONAL_GITHUB_PUSH_TOKEN` -
This is only needed if you want to automatically git-tag release branches.
To make a API token go to:
Expand All @@ -47,8 +47,8 @@ GITLAB ACTION INSTRUCTIONS
tee /tmp/repl && colordiff .setup_secrets.sh /tmp/repl
```
* Make sure you add Runners to your project
https://gitlab.org.com/utils/xcookie/-/settings/ci_cd
* Make sure you add Runners to your project
https://gitlab.org.com/utils/xcookie/-/settings/ci_cd
in Runners-> Shared Runners
and Runners-> Available specific runners
Expand All @@ -60,16 +60,16 @@ GITLAB ACTION INSTRUCTIONS
* TWINE_USERNAME - this is your pypi username
twine info is only needed if you want to automatically publish to pypi
* TWINE_PASSWORD - this is your pypi password
* TWINE_PASSWORD - this is your pypi password
* CI_SECRET - We will use this as a secret key to encrypt/decrypt gpg secrets
* CI_SECRET - We will use this as a secret key to encrypt/decrypt gpg secrets
This is only needed if you want to automatically sign published
wheels with a gpg key.
* GITLAB_ORG_PUSH_TOKEN -
* GITLAB_ORG_PUSH_TOKEN -
This is only needed if you want to automatically git-tag release branches.
Create a new personal access token in User->Settings->Tokens,
Create a new personal access token in User->Settings->Tokens,
You can name the token GITLAB_ORG_PUSH_TOKEN_VALUE
Give it api and write repository permissions
Expand Down Expand Up @@ -165,8 +165,8 @@ setup_package_environs_github_pyutils(){
upload_github_secrets(){
load_secrets
unset GITHUB_TOKEN
#printf "%s" "$GITHUB_TOKEN" | gh auth login --hostname Github.com --with-token
gh auth login
#printf "%s" "$GITHUB_TOKEN" | gh auth login --hostname Github.com --with-token
gh auth login
source dev/secrets_configuration.sh
gh secret set "TWINE_USERNAME" -b"${!VARNAME_TWINE_USERNAME}"
gh secret set "TEST_TWINE_USERNAME" -b"${!VARNAME_TEST_TWINE_USERNAME}"
Expand Down Expand Up @@ -223,15 +223,15 @@ upload_gitlab_group_secrets(){

TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX)
curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups" > "$TMP_DIR/all_group_info"
GROUP_ID=$(cat "$TMP_DIR/all_group_info" | jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id")
GROUP_ID=$(< "$TMP_DIR/all_group_info" jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id")
echo "GROUP_ID = $GROUP_ID"

curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID" > "$TMP_DIR/group_info"
cat "$TMP_DIR/group_info" | jq
< "$TMP_DIR/group_info" jq

# Get group-level secret variables
curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID/variables" > "$TMP_DIR/group_vars"
cat "$TMP_DIR/group_vars" | jq '.[] | .key'
< "$TMP_DIR/group_vars" jq '.[] | .key'

if [[ "$?" != "0" ]]; then
echo "Failed to access group level variables. Probably a permission issue"
Expand All @@ -244,7 +244,7 @@ upload_gitlab_group_secrets(){
echo ""
echo " ---- "
LOCAL_VALUE=${!SECRET_VARNAME}
REMOTE_VALUE=$(cat "$TMP_DIR/group_vars" | jq -r ".[] | select(.key==\"$SECRET_VARNAME\") | .value")
REMOTE_VALUE=$(< "$TMP_DIR/group_vars" jq -r ".[] | select(.key==\"$SECRET_VARNAME\") | .value")

# Print current local and remote value of a variable
echo "SECRET_VARNAME_PTR = $SECRET_VARNAME_PTR"
Expand All @@ -264,14 +264,14 @@ upload_gitlab_group_secrets(){
--form "protected=true" \
--form "masked=true" \
--form "environment_scope=*" \
--form "variable_type=env_var"
--form "variable_type=env_var"
toggle_setx_exit
elif [[ "$REMOTE_VALUE" != "$LOCAL_VALUE" ]]; then
echo "Remove variable does not agree, putting"
# Update variable value
toggle_setx_enter
curl --request PUT --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID/variables/$SECRET_VARNAME" \
--form "value=${LOCAL_VALUE}"
--form "value=${LOCAL_VALUE}"
toggle_setx_exit
else
echo "Remote value agrees with local"
Expand Down Expand Up @@ -305,23 +305,23 @@ upload_gitlab_repo_secrets(){
toggle_setx_enter
curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups" > "$TMP_DIR/all_group_info"
toggle_setx_exit
GROUP_ID=$(cat "$TMP_DIR/all_group_info" | jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id")
GROUP_ID=$(< "$TMP_DIR/all_group_info" jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id")
echo "GROUP_ID = $GROUP_ID"

toggle_setx_enter
curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/groups/$GROUP_ID" > "$TMP_DIR/group_info"
toggle_setx_exit
GROUP_ID=$(cat "$TMP_DIR/all_group_info" | jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id")
cat "$TMP_DIR/group_info" | jq
GROUP_ID=$(< "$TMP_DIR/all_group_info" jq ". | map(select(.path==\"$GROUP_NAME\")) | .[0].id")
< "$TMP_DIR/group_info" jq

PROJECT_ID=$(cat "$TMP_DIR/group_info" | jq ".projects | map(select(.path==\"$PROJECT_NAME\")) | .[0].id")
PROJECT_ID=$(< "$TMP_DIR/group_info" jq ".projects | map(select(.path==\"$PROJECT_NAME\")) | .[0].id")
echo "PROJECT_ID = $PROJECT_ID"

# Get group-level secret variables
toggle_setx_enter
curl --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/projects/$PROJECT_ID/variables" > "$TMP_DIR/project_vars"
toggle_setx_exit
cat "$TMP_DIR/project_vars" | jq '.[] | .key'
< "$TMP_DIR/project_vars" jq '.[] | .key'
if [[ "$?" != "0" ]]; then
echo "Failed to access project level variables. Probably a permission issue"
fi
Expand All @@ -334,7 +334,7 @@ upload_gitlab_repo_secrets(){
echo ""
echo " ---- "
LOCAL_VALUE=${!SECRET_VARNAME}
REMOTE_VALUE=$(cat "$TMP_DIR/project_vars" | jq -r ".[] | select(.key==\"$SECRET_VARNAME\") | .value")
REMOTE_VALUE=$(< "$TMP_DIR/project_vars" jq -r ".[] | select(.key==\"$SECRET_VARNAME\") | .value")

# Print current local and remote value of a variable
echo "SECRET_VARNAME_PTR = $SECRET_VARNAME_PTR"
Expand All @@ -353,7 +353,7 @@ upload_gitlab_repo_secrets(){
--form "protected=true" \
--form "masked=true" \
--form "environment_scope=*" \
--form "variable_type=env_var"
--form "variable_type=env_var"
else
echo "dry run, not posting"
fi
Expand All @@ -362,7 +362,7 @@ upload_gitlab_repo_secrets(){
# Update variable value
if [[ "$LIVE_MODE" == "1" ]]; then
curl --request PUT --header "PRIVATE-TOKEN: $PRIVATE_GITLAB_TOKEN" "$HOST/api/v4/projects/$PROJECT_ID/variables/$SECRET_VARNAME" \
--form "value=${LOCAL_VALUE}"
--form "value=${LOCAL_VALUE}"
else
echo "dry run, not putting"
fi
Expand Down Expand Up @@ -405,7 +405,7 @@ export_encrypted_code_signing_keys(){
echo "MAIN_GPG_KEYID = $MAIN_GPG_KEYID"
echo "GPG_SIGN_SUBKEY = $GPG_SIGN_SUBKEY"

# Only export the signing secret subkey
# Only export the signing secret subkey
# Export plaintext gpg public keys, private sign key, and trust info
mkdir -p dev
gpg --armor --export-options export-backup --export-secret-subkeys "${GPG_SIGN_SUBKEY}!" > dev/ci_secret_gpg_subkeys.pgp
Expand All @@ -421,7 +421,7 @@ export_encrypted_code_signing_keys(){
# Test decrpyt
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_public_gpg_key.pgp.enc | gpg --list-packets --verbose
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_secret_gpg_subkeys.pgp.enc | gpg --list-packets --verbose
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/gpg_owner_trust.enc
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/gpg_owner_trust.enc
cat dev/public_gpg_key

unload_secrets
Expand Down Expand Up @@ -451,14 +451,14 @@ _test_gnu(){
source dev/secrets_configuration.sh

gpg -k

load_secrets
CI_SECRET="${!VARNAME_CI_SECRET}"
echo "CI_SECRET = $CI_SECRET"

cat dev/public_gpg_key
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_public_gpg_key.pgp.enc
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/gpg_owner_trust.enc
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_public_gpg_key.pgp.enc
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/gpg_owner_trust.enc
GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_secret_gpg_subkeys.pgp.enc

GLKWS=$CI_SECRET openssl enc -aes-256-cbc -pbkdf2 -md SHA512 -pass env:GLKWS -d -a -in dev/ci_public_gpg_key.pgp.enc | gpg --import
Expand Down
Loading

0 comments on commit e812752

Please sign in to comment.