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

Run tests with a realistic version of git #2043

Merged
merged 4 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 52 additions & 0 deletions .github/workflows/pytest-frozen-ubuntu-20.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Python tests Ubuntu-20.04 (frozen)
# This workflow is triggered on pushes and PRs to the repository.
# Only run if we changed a Python file
on:
push:
branches:
- dev
pull_request:
release:
types: [published]

# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
pytest:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
name: Check out source-code repository

- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: "3.8"

- name: Install python dependencies
run: |
python -m pip install --upgrade pip -r requirements-dev.txt
pip install -e .

- name: Downgrade git to the Ubuntu official repository's version
run: |
sudo apt remove git git-man
sudo add-apt-repository --remove ppa:git-core/ppa
sudo apt install git

- name: Install Nextflow
uses: nf-core/setup-nextflow@v1
with:
version: "latest-everything"

- name: Test with pytest
run: python3 -m pytest tests/ --color=yes --cov-report=xml --cov-config=.github/.coveragerc --cov=nf_core

- uses: codecov/codecov-action@v1
name: Upload code coverage report
with:
if: success()
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Add file `versions.yml` when generating `test.yml` with `nf-core modules create-test-yml` but don't check for md5sum [#1963](https://github.com/nf-core/tools/pull/1963)
- Mock biocontainers and anaconda api calls in modules and subworkflows tests [#1967](https://github.com/nf-core/tools/pull/1967)
- Run tests with Python 3.11 ([#1970](https://github.com/nf-core/tools/pull/1970))
- Run test with a realistic version of git ([#2043](https://github.com/nf-core/tools/pull/2043))
- Bump promoted Python version from 3.7 to 3.8 ([#1971](https://github.com/nf-core/tools/pull/1971))
- Fix incorrect file deletion in `nf-core launch` when `--params_in` has the same name as `--params_out`
- Updated GitHub actions ([#1998](https://github.com/nf-core/tools/pull/1998), [#2001](https://github.com/nf-core/tools/pull/2001))
Expand Down
4 changes: 2 additions & 2 deletions nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ def git_init_pipeline(self):

log.info("Initialising pipeline git repository")
repo = git.Repo.init(self.outdir)
if default_branch:
repo.active_branch.rename(default_branch)
repo.git.add(A=True)
repo.index.commit(f"initial template build from nf-core/tools, version {nf_core.__version__}")
if default_branch:
repo.active_branch.rename(default_branch)
repo.git.branch("TEMPLATE")
repo.git.branch("dev")
log.info(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def setUp(self):
self.create_obj.init_pipeline()
self.remote_path = os.path.join(self.tmp_dir, "remote_repo")
self.remote_repo = git.Repo.init(self.remote_path, bare=True)
self.remote_repo.active_branch.rename(default_branch)

if self.remote_repo.active_branch.name != "master":
self.remote_repo.active_branch.rename(default_branch)

def tearDown(self):
if os.path.exists(self.tmp_dir):
Expand Down