Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests #72

Draft
wants to merge 40 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5634a61
Fix softprops/action-gh-release version
Hind-M Jan 7, 2025
3d0f4af
Fix files
Hind-M Jan 7, 2025
8119209
Add token
Hind-M Jan 7, 2025
db30418
Add fetch_release tests
Hind-M Jan 8, 2025
cc320e0
Add gitignore
Hind-M Jan 8, 2025
acef6a9
Use softprops/action-gh-release@v2.2.0
Hind-M Jan 8, 2025
5c90d06
Add more tests
Hind-M Jan 8, 2025
d8a1569
Fix os env var
Hind-M Jan 8, 2025
5bbdab0
Remove 1.5.10 for now
Hind-M Jan 8, 2025
d200164
Change test
Hind-M Jan 8, 2025
61dafcf
Fix test
Hind-M Jan 8, 2025
fe6d72d
Add tests
Hind-M Jan 9, 2025
d14510f
Change tests
Hind-M Jan 9, 2025
814fe60
Use version
Hind-M Jan 9, 2025
7d78859
Add print
Hind-M Jan 9, 2025
6e9d143
Change version
Hind-M Jan 9, 2025
f6f5c94
Change specs in env file
Hind-M Jan 9, 2025
53e7909
Add mock test
Hind-M Jan 9, 2025
a26579d
Add missing subdirs
Hind-M Jan 9, 2025
2579980
Add ','
Hind-M Jan 9, 2025
190f0f6
Add missing keys
Hind-M Jan 9, 2025
3cee4bb
Add mock_check_call
Hind-M Jan 9, 2025
966eb36
Comment leftover
Hind-M Jan 9, 2025
b844419
Mock copyfile
Hind-M Jan 9, 2025
898c642
mock_copyfile_side_effect
Hind-M Jan 9, 2025
4602c6b
Add raise_for_status
Hind-M Jan 9, 2025
409600e
Not use module
Hind-M Jan 9, 2025
6b728fc
Add checks
Hind-M Jan 10, 2025
11ae570
Add fetch_release
Hind-M Jan 10, 2025
93c7c73
Remove symlink arg
Hind-M Jan 10, 2025
2652b38
Set mock_copyfile.return_value
Hind-M Jan 10, 2025
a81df81
Add None
Hind-M Jan 10, 2025
180b081
Add args and kargs
Hind-M Jan 10, 2025
1eaca56
Add raise_for_status
Hind-M Jan 10, 2025
03009ff
Remove .github/workflows/test_release_publisher.yml
Hind-M Jan 10, 2025
55ffcf5
Use two mock functions for get requests
Hind-M Jan 10, 2025
772f8ea
Add module name before func
Hind-M Jan 10, 2025
61eef66
Put func outside
Hind-M Jan 10, 2025
f39ab3b
Add fixtures
Hind-M Jan 10, 2025
d4e6cb0
add module
Hind-M Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ jobs:
- shell: bash -l {0}
id: fetch-release
run: |
python -m pip install packaging
python fetch_release.py ${{ github.event.inputs.version }}

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2.2.0
if: steps.fetch-release.outputs.MICROMAMBA_NEW_VERSION == 'true'
with:
name: "micromamba ${{ steps.fetch-release.outputs.MICROMAMBA_VERSION }}"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test_fetch_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Test fetching releases from Anaconda"

on:
pull_request:
branches:
- main

jobs:
test_fetch_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: pytest
- name: Add micromamba to GITHUB_PATH
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH"

- shell: bash -l {0}
id: fetch-release
run: |
python -m pytest tests/test_fetch_release.py -v --exitfirst
File renamed without changes.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Python caches
*.pyc
.pytest_cache/
__pycache__

# Generated files from tests
*.tar.bz2
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: fetch-release-env
channels:
- conda-forge
dependencies:
- packaging
- python
- requests
- rich
3 changes: 2 additions & 1 deletion fetch_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def get_micromamba(version, use_default_version):
build = max(all_build)

print(f"Existing versions: {existing_tags}")
print(f"Checking {version}-{build}")
if f"{version}-{build}" in existing_tags:
print("Tag already exists, skipping")
set_output("MICROMAMBA_NEW_VERSION", "false")
Expand Down Expand Up @@ -150,7 +151,7 @@ def get_micromamba(version, use_default_version):
else:
set_output("MICROMAMBA_NEW_PRERELEASE", "true")

if is_stable and v.major == 2:
if is_stable and v.major >= 2:
set_output("MICROMAMBA_LATEST", "true")
else:
set_output("MICROMAMBA_LATEST", "false")
Expand Down
Loading
Loading