Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Dependencies come from `make install`, and CI uses the same target. The rest of

**`make setup` installs nothing.** The target reads `setup: pull setup`, so make drops the circular dependency, runs `pull`, stops there and still exits 0.

`make test` needs the fixture image that `make pull` fetches. A single file goes through jest directly: `npx jest __tests__/packageChecker.test.js`.
`make test` needs the fixture image that `make pull` fetches. A single file goes through jest directly: `npx jest __tests__/index.test.js`.

The fixture image name `hexlet-project-source-ci_en` is pinned in three places that have to agree: `Makefile` (target `pull`), `server.js` (the API stub for `e2e`) and `__tests__/index.test.js` (the nock response).

Expand All @@ -31,7 +31,8 @@ The fixture image name `hexlet-project-source-ci_en` is pinned in three places t
- `dist/` is gitignored and stays out of git: `release.yml` builds it with `@vercel/ncc` and force-adds it onto the `release` branch. `action.yml` points at `dist/run-tests/index.js` and `dist/run-post-actions/index.js`.
- Two entry points in `bin/` are the two phases of the Action: `bin/run-tests.js` (main) and `bin/run-post-actions.js` (post — finishes the check and uploads artifacts).
- `src/index.js` holds the orchestration: `prepareProject()` pulls the image and extracts the project source, `check()` runs Compose, `runTests()` and `runPostActions()` talk to the Hexlet API.
- `src/routes.js` builds the API urls. `src/packageChecker.js` validates the package name of the student's project against the conventions of its language, reading `pyproject.toml`, `composer.json` or `package.json`.
- `src/routes.js` builds the API urls.
- **The action does not check the name of the student's package.** It used to, per language, and the check was dropped: the name is load-bearing only where the project's own harness resolves the package by it. That is the php library projects, whose root `composer.json` requires `hexlet/code` from a path repository — a wrong name fails `composer install` on its own. For javascript the harness `package.json` names the dependency `"@hexlet/code": "file:code"`, and npm installs a path dependency under that key whatever the package calls itself, so the import resolves either way. For python nothing reads the distribution name: the console scripts have names of their own.
- `check()` calls two fixed compose service names of the project — `app` for `make setup`, then `test` — and the exit code of `test` is the verdict. Both the fixed names and the flags carry `NOTE` comments in the code; read them before changing the commands.
- Tests stub the Hexlet API with a local Fastify server (`server.js`), fixtures live in `__fixtures__/`.
- Artifacts of the student's tests are collected from `<project>/tmp/artifacts/*/**` and uploaded as the `test-results` artifact. The glob starts one level down, so a file lying directly in `tmp/artifacts/` never reaches the student.
Expand Down
64 changes: 0 additions & 64 deletions __fixtures__/package_files/correct/composer.json

This file was deleted.

29 changes: 0 additions & 29 deletions __fixtures__/package_files/correct/package.json

This file was deleted.

27 changes: 0 additions & 27 deletions __fixtures__/package_files/correct/pyproject.toml

This file was deleted.

64 changes: 0 additions & 64 deletions __fixtures__/package_files/wrong/composer.json

This file was deleted.

29 changes: 0 additions & 29 deletions __fixtures__/package_files/wrong/package.json

This file was deleted.

33 changes: 0 additions & 33 deletions __fixtures__/package_files/wrong/pyproject.toml

This file was deleted.

50 changes: 0 additions & 50 deletions __tests__/packageChecker.test.js

This file was deleted.

15 changes: 0 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"ansi-colors": "^4.1.3",
"chalk": "^5.6.2",
"clean-stack": "^6.0.0",
"ini": "^6.0.0",
"js-yaml": "^4.1.1",
"lodash": "^4.18.1"
},
Expand Down
5 changes: 1 addition & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { HttpClient } from '@actions/http-client';
import * as io from '@actions/io';
import colors from 'ansi-colors';
import yaml from 'js-yaml';
import checkPackageName from './packageChecker.js';
import buildRoutes from './routes.js';

const uploadArtifacts = async (diffpath) => {
Expand Down Expand Up @@ -135,9 +134,7 @@ const prepareProject = async (options) => {
});
};

const check = async ({ projectSourcePath, codePath, projectMember }) => {
const sourceLang = projectMember.project.language;
checkPackageName(codePath, sourceLang);
const check = async ({ projectSourcePath }) => {
const options = { cwd: projectSourcePath };
// NOTE: -f docker-compose.yml is required: the project image also carries
// docker-compose.override.yml, which switches app to its dev command.
Expand Down
Loading