mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-02-15 07:01:39 +00:00
Merge remote-tracking branch 'origin/master' into nightly
This commit is contained in:
commit
9466fc395b
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
@ -20,13 +20,16 @@ jobs:
|
|||||||
# https://github.com/actions/runner-images#available-images
|
# https://github.com/actions/runner-images#available-images
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
locale: C.UTF-8
|
locale: C.UTF-8
|
||||||
|
gh_os: linux
|
||||||
# https://endoflife.date/macos
|
# https://endoflife.date/macos
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
locale: en_US.UTF-8
|
locale: en_US.UTF-8
|
||||||
|
gh_os: macOs
|
||||||
env:
|
env:
|
||||||
LC_ALL: ${{ matrix.locale }}
|
LC_ALL: ${{ matrix.locale }}
|
||||||
LANG: ${{ matrix.locale }}
|
LANG: ${{ matrix.locale }}
|
||||||
steps:
|
steps:
|
||||||
|
##### Setup environment
|
||||||
# https://github.com/actions/checkout
|
# https://github.com/actions/checkout
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
@ -42,26 +45,26 @@ jobs:
|
|||||||
run: make ci-info
|
run: make ci-info
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
run: make bootstrap-dev-plugins
|
run: make bootstrap-dev-plugins
|
||||||
|
|
||||||
|
##### Run tests, generate bundle
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: make test
|
run: make test
|
||||||
- name: Create bundle
|
- name: Create bundle
|
||||||
run: make bundle
|
run: make bundle
|
||||||
- name: Test bundle
|
- name: Test bundle
|
||||||
run: make ci-test-bundle
|
run: make ci-test-bundle
|
||||||
|
|
||||||
|
##### Download gh utility: https://github.com/cli/cli/releases
|
||||||
- name: Check for presence of "gh" CLI utility
|
- name: Check for presence of "gh" CLI utility
|
||||||
run: echo "gh_bin=$(which gh)" >> $GITHUB_ENV
|
run: echo "gh_bin=$(which gh)" >> $GITHUB_ENV
|
||||||
- name: Download gh utility (linux)
|
- name: Download gh utility
|
||||||
run: |
|
run: |
|
||||||
curl -L -o gh.tar.gz https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_linux_amd64.tar.gz
|
curl -L -o gh.tar.gz https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_${{ matrix.gh_os }}_amd64.tar.gz
|
||||||
tar xzf gh.tar.gz
|
tar xzf gh.tar.gz
|
||||||
echo "gh_bin=./gh_2.20.2_linux_amd64/bin/gh" >> $GITHUB_ENV
|
echo "gh_bin=./gh_2.20.2_${{ matrix.gh_os }}_amd64/bin/gh" >> $GITHUB_ENV
|
||||||
if: ${{ env.gh_bin == '' && !contains(matrix.os, 'macos') }}
|
if: ${{ env.gh_bin == '' }}
|
||||||
- name: Download gh utility (macos)
|
|
||||||
run: |
|
##### Create release on GitHub
|
||||||
curl -L -o gh.tar.gz https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_macOS_amd64.tar.gz
|
|
||||||
tar xzf gh.tar.gz
|
|
||||||
echo "gh_bin=./gh_2.20.2_macOS_amd64/bin/gh" >> $GITHUB_ENV
|
|
||||||
if: ${{ env.gh_bin == '' && contains(matrix.os, 'macos') }}
|
|
||||||
- name: Create or update GitHub release
|
- name: Create or update GitHub release
|
||||||
# I wish there was an `--update` option to the `gh release create` command, but
|
# I wish there was an `--update` option to the `gh release create` command, but
|
||||||
# there isn't.
|
# there isn't.
|
||||||
@ -71,8 +74,12 @@ jobs:
|
|||||||
export GH_ARGS="${{ github.ref }} --notes-file=release_description.md"
|
export GH_ARGS="${{ github.ref }} --notes-file=release_description.md"
|
||||||
echo "gh args: '$GH_ARGS"
|
echo "gh args: '$GH_ARGS"
|
||||||
${{ env.gh_bin }} release create $GH_ARGS || ${{ env.gh_bin }} release edit $GH_ARGS
|
${{ env.gh_bin }} release create $GH_ARGS || ${{ env.gh_bin }} release edit $GH_ARGS
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
- name: Upload release asset to GitHub
|
- name: Upload release asset to GitHub
|
||||||
run: |
|
run: |
|
||||||
export FILENAME="tutor-$(uname -s)_$(uname -m)"
|
export FILENAME="tutor-$(uname -s)_$(uname -m)"
|
||||||
mv ./dist/tutor $FILENAME
|
mv ./dist/tutor $FILENAME
|
||||||
${{ env.gh_bin }} release upload --clobber ${{ github.ref }} $FILENAME
|
${{ env.gh_bin }} release upload --clobber ${{ github.ref }} $FILENAME
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
2
.github/workflows/sync.yml
vendored
2
.github/workflows/sync.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
sync:
|
sync:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Add remote
|
- name: Add remote
|
||||||
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -10,9 +10,9 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: 3.9
|
||||||
- name: Upgrade pip
|
- name: Upgrade pip
|
||||||
|
@ -32,7 +32,8 @@ class TestCommandMixin:
|
|||||||
"TUTOR_ROOT": root,
|
"TUTOR_ROOT": root,
|
||||||
"TUTOR_IGNORE_ENTRYPOINT_PLUGINS": "1",
|
"TUTOR_IGNORE_ENTRYPOINT_PLUGINS": "1",
|
||||||
"TUTOR_IGNORE_DICT_PLUGINS": "1",
|
"TUTOR_IGNORE_DICT_PLUGINS": "1",
|
||||||
}
|
},
|
||||||
|
mix_stderr=False,
|
||||||
)
|
)
|
||||||
return runner.invoke(
|
return runner.invoke(
|
||||||
cli, args, obj=TestContext(root), catch_exceptions=catch_exceptions
|
cli, args, obj=TestContext(root), catch_exceptions=catch_exceptions
|
||||||
|
@ -70,8 +70,17 @@ class UtilsTests(unittest.TestCase):
|
|||||||
self.assertIsNotNone(imported.q)
|
self.assertIsNotNone(imported.q)
|
||||||
|
|
||||||
def test_is_root(self) -> None:
|
def test_is_root(self) -> None:
|
||||||
result = utils.is_root()
|
with patch("sys.platform", "win32"):
|
||||||
self.assertFalse(result)
|
with patch.object(utils, "get_user_id", return_value=42):
|
||||||
|
self.assertFalse(utils.is_root())
|
||||||
|
with patch.object(utils, "get_user_id", return_value=0):
|
||||||
|
self.assertFalse(utils.is_root())
|
||||||
|
|
||||||
|
with patch("sys.platform", "linux"):
|
||||||
|
with patch.object(utils, "get_user_id", return_value=42):
|
||||||
|
self.assertFalse(utils.is_root())
|
||||||
|
with patch.object(utils, "get_user_id", return_value=0):
|
||||||
|
self.assertTrue(utils.is_root())
|
||||||
|
|
||||||
@patch("sys.platform", "win32")
|
@patch("sys.platform", "win32")
|
||||||
def test_is_root_win32(self) -> None:
|
def test_is_root_win32(self) -> None:
|
||||||
@ -79,11 +88,11 @@ class UtilsTests(unittest.TestCase):
|
|||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
|
|
||||||
def test_get_user_id(self) -> None:
|
def test_get_user_id(self) -> None:
|
||||||
result = utils.get_user_id()
|
with patch("os.getuid", return_value=42):
|
||||||
if sys.platform == "win32":
|
self.assertEqual(42, utils.get_user_id())
|
||||||
self.assertEqual(0, result)
|
|
||||||
else:
|
with patch("sys.platform", new="win32"):
|
||||||
self.assertNotEqual(0, result)
|
self.assertEqual(0, utils.get_user_id())
|
||||||
|
|
||||||
@patch("sys.platform", "win32")
|
@patch("sys.platform", "win32")
|
||||||
def test_get_user_id_win32(self) -> None:
|
def test_get_user_id_win32(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user