Skip to content

Commit

Permalink
Merge branch 'frej/run-tests-with-different-python-versions'
Browse files Browse the repository at this point in the history
  • Loading branch information
frej committed Dec 28, 2023
2 parents 3c69424 + 2476d08 commit 878ba44
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/requirements-earliest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mercurial==5.2
2 changes: 2 additions & 0 deletions .github/requirements-latest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mercurial

69 changes: 64 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,70 @@ on:
branches: [master]

jobs:
test:
name: Run test suite
test-earliest:
name: Run test suite on the earliest supported Python version
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 1
submodules: 'recursive'
- uses: actions/setup-python@v5
id: earliest
with:
python-version: '3.7.x'
check-latest: true
cache: 'pip'
cache-dependency-path: '**/requirements-earliest.txt'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/requirements-earliest.txt
- name: Report selected versions
run: |
echo Selected '${{ steps.earliest.outputs.python-version }}'
./hg-fast-export.sh --debug
- name: Run tests on earliest supported Python version
run: make -C t

test-latest:
name: Run test suite on the latest supported python version
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 1
submodules: 'recursive'
- uses: actions/setup-python@v5
id: latest
with:
python-version: '3.x'
check-latest: true
cache: 'pip'
cache-dependency-path: '**/requirements-latest.txt'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/requirements-latest.txt
- name: Report selected version
run: |
echo Selected '${{ steps.latest.outputs.python-version }}'
./hg-fast-export.sh --debug
- name: Run tests on 3.x
run: make -C t

code-quality:
name: Run code quality checks
runs-on: ubuntu-latest

steps:
Expand All @@ -19,9 +81,6 @@ jobs:
fetch-depth: 1
submodules: 'recursive'

- name: Run tests
run: make -C t

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ first time.
System Requirements
-------------------

This project depends on Python 3.5+, and the Mercurial >= 5.2 package.
If Python is not installed, install it before proceeding. The Mercurial
package can be installed with `pip install mercurial`.
This project depends on Python (>=3.7) and the Mercurial package (>=
5.2). If Python is not installed, install it before proceeding. The
Mercurial package can be installed with `pip install mercurial`.

On windows the bash that comes with "Git for Windows" is known to work
well.
Expand Down
16 changes: 16 additions & 0 deletions hg-fast-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ if [ -z "${PYTHON}" ]; then
exit 1
fi

"${PYTHON}" -c 'import sys; exit(sys.version_info.major==3 and sys.version_info.minor >= 7)'

if [ $? -eq 0 ]; then
echo "Could not find an interpreter for a supported Python version (>= 3.7)" \
"Please use the 'PYTHON' environment variable to specify the interpreter to use."
exit 1
fi

USAGE="[--quiet] [-r <repo>] [--force] [--ignore-unnamed-heads] [-m <max>] [-s] [--hgtags] [-A <file>] [-B <file>] [-T <file>] [-M <name>] [-o <name>] [--hg-hash] [-e <encoding>]"
LONG_USAGE="Import hg repository <repo> up to either tip or <max>
If <repo> is omitted, use last hg repository as obtained from state file,
Expand Down Expand Up @@ -86,6 +94,14 @@ case "$1" in
echo ""
echo "$LONG_USAGE"
exit 0
;;

--debug)
echo -n "Using Python: "
"${PYTHON}" --version
echo -n "Using Mercurial: "
hg --version
exit 0
esac

IS_BARE=$(git rev-parse --is-bare-repository) \
Expand Down

0 comments on commit 878ba44

Please sign in to comment.