forked from conda-incubator/conda-store
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (98 loc) · 3.3 KB
/
test_conda_store_server_unit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: "Test conda-store-server (unit)"
env:
FORCE_COLOR: "1" # Make tools pretty.
on:
pull_request:
paths:
- ".github/workflows/**"
- ".github/actions/**"
- "conda-store/**"
- "conda-store-server/**"
- "examples/**"
- "tests/**"
push:
branches:
- main
# ensuring only one instance is running at a given time
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
defaults:
run:
working-directory: conda-store-server
steps:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4
- name: "Set up Python 🐍"
uses: actions/setup-python@v5
with:
python-version-file: .python-version-default
cache: "pip"
- name: "Install Dependencies 📦"
run: |
python -m pip install hatch
- name: "Linting Checks 🧹"
run: |
hatch env run -e lint lint
test-conda-store-server:
name: "unit-test - ${{ matrix.os}} "
strategy:
matrix:
# ubuntu 22.04, macos 14, windows 2022
# os: ["ubuntu-latest", "macos-latest", "windows-latest"]
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
working-directory: conda-store-server
steps:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4
- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Set up env ${{ matrix.os }} 🐍"
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: conda-store-server/environment-dev.yaml
miniforge-version: latest
auto-activate-base: false
activate-environment: conda-store-server-dev
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
conda-remove-defaults: "true"
# This fixes a "DLL not found" issue importing ctypes from the hatch env
- name: "Reinstall Python on Windows runner"
uses: nick-fields/[email protected]
with:
timeout_minutes: 9999
max_attempts: 6
command:
conda install --channel=conda-forge --quiet --yes python=${{ env.PYTHON_VERSION_DEFAULT }}
if: matrix.os == 'windows-latest'
- name: "Install conda-store server 📦"
run: |
python -m pip install .
# some checks
conda list
which python
- name: "Unit tests ✅"
run: |
python -m pytest -m "not extended_prefix and not user_journey" --cov=conda_store_server tests
- name: "Coverage report"
run: |
coverage report
# https://github.com/actions/runner-images/issues/1052
- name: "Windows extended prefix unit tests ✅"
shell: pwsh
run: |
Set-ItemProperty "HKLM:\System\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" `
-Value 0 `
-Type DWord
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
pytest -m "extended_prefix" tests
if: matrix.os == 'windows-latest'