6060 # Use nix develop to run linting tools defined in flake.nix
6161 nix develop --command black --check server.py test_mcp.py
6262
63- test-dry :
64- name : Test (Dry Run)
63+ test :
64+ name : Run Tests
6565 runs-on : ubuntu-latest
6666 needs : [build]
6767 steps :
9090 restore-keys : |
9191 ${{ runner.os }}-venv-
9292
93- - name : Setup and run dry tests
93+ - name : Setup and run tests
9494 run : |
9595 # Use nix develop to set up environment and run tests
9696 nix develop --command setup
97- nix develop --command run-tests-dry
98-
99- test-full :
100- name : Test (Full)
101- runs-on : ubuntu-latest
102- needs : [lint, test-dry]
103- steps :
104- - uses : actions/checkout@v3
105-
106- - uses : cachix/install-nix-action@v23
107- with :
108- nix_path : nixpkgs=channel:nixos-unstable
109- extra_nix_config : |
110- experimental-features = nix-command flakes
111-
112- - name : Cache Nix store
113- uses : actions/cache@v3
114- with :
115- path : |
116- ~/.cache/nix
117- key : ${{ runner.os }}-nix-${{ hashFiles('flake.lock') }}
118- restore-keys : |
119- ${{ runner.os }}-nix-
120-
121- - name : Cache Python virtual environment
122- uses : actions/cache@v3
123- with :
124- path : .venv
125- key : ${{ runner.os }}-venv-${{ hashFiles('requirements.txt') }}
126- restore-keys : |
127- ${{ runner.os }}-venv-
128-
129- - name : Install NixOS tools
130- run : |
131- # Only needed for full tests that require nixos-option
132- sudo apt-get update
133- sudo apt-get install -y curl
134-
135- - name : Setup and run full tests
136- run : |
137- # Setup environment
138- nix develop --command setup
139- nix develop --command setup-test
140-
141- # Start server in background
142- nix develop --command run --port=9421 &
143- SERVER_PID=$!
144-
145- # Wait for server to start
146- echo "Waiting for server to start..."
147- for i in {1..30}; do
148- if curl -s http://localhost:9421/docs &>/dev/null; then
149- echo "Server started successfully!"
150- break
151- fi
152- if [ $i -eq 30 ]; then
153- echo "Server failed to start in time"
154- kill $SERVER_PID
155- exit 1
156- fi
157- sleep 1
158- done
159-
160- # Run tests against running server
161- nix develop --command run-tests-with-server
162- TEST_EXIT=$?
163-
164- # Clean up server
165- kill $SERVER_PID
166-
167- # Return the test exit code
168- exit $TEST_EXIT
97+ nix develop --command run-tests
0 commit comments