diff --git a/.github/requirements-earliest.txt b/.github/requirements-earliest.txt new file mode 100644 index 0000000..cc72e71 --- /dev/null +++ b/.github/requirements-earliest.txt @@ -0,0 +1 @@ +mercurial==5.2 diff --git a/.github/requirements-latest.txt b/.github/requirements-latest.txt new file mode 100644 index 0000000..3620838 --- /dev/null +++ b/.github/requirements-latest.txt @@ -0,0 +1,2 @@ +mercurial + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57efee7..e511200 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: diff --git a/README.md b/README.md index b4aa33c..abd9a70 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/hg-fast-export.sh b/hg-fast-export.sh index be52c5d..7d6d7b7 100755 --- a/hg-fast-export.sh +++ b/hg-fast-export.sh @@ -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 ] [--force] [--ignore-unnamed-heads] [-m ] [-s] [--hgtags] [-A ] [-B ] [-T ] [-M ] [-o ] [--hg-hash] [-e ]" LONG_USAGE="Import hg repository up to either tip or If is omitted, use last hg repository as obtained from state file, @@ -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) \