ci: use Gitea API for releases #2

Closed
adrianbonpin wants to merge 56 commits from feat/ismis-helper into prod
2 changed files with 21 additions and 1 deletions
Showing only changes of commit 41e7a4b81e - Show all commits
+3
View File
@@ -21,6 +21,9 @@ jobs:
- name: Install dev dependencies - name: Install dev dependencies
run: npm ci || npm install run: npm ci || npm install
- name: Install PyMuPDF (PDF text assertions)
run: python3 -m pip install --quiet pymupdf
- name: Run tests - name: Run tests
run: npm test run: npm test
+18 -1
View File
@@ -38,7 +38,19 @@ function extractPdfText(bytes) {
return execFileSync('python3', ['-c', script], { encoding: 'utf8' }); return execFileSync('python3', ['-c', script], { encoding: 'utf8' });
} }
test('buildStudyLoadPdf returns valid PDF bytes', async () => { // PyMuPDF (fitz) is only needed for the text-extraction assertions below. It is
// installed in CI, but if it is missing locally we skip those assertions rather
// than hard-failing.
function fitzAvailable() {
try {
execFileSync('python3', ['-c', 'import fitz'], { stdio: 'ignore' });
return true;
} catch {
return false;
}
}
test('buildStudyLoadPdf returns valid PDF bytes', async (t) => {
const bytes = await buildStudyLoadPdf(sampleData); const bytes = await buildStudyLoadPdf(sampleData);
assert.ok(bytes instanceof Uint8Array); assert.ok(bytes instanceof Uint8Array);
const head = Buffer.from(bytes.slice(0, 5)).toString('latin1'); const head = Buffer.from(bytes.slice(0, 5)).toString('latin1');
@@ -46,6 +58,11 @@ test('buildStudyLoadPdf returns valid PDF bytes', async () => {
const doc = await PDFLib.PDFDocument.load(bytes); const doc = await PDFLib.PDFDocument.load(bytes);
assert.strictEqual(doc.getPageCount(), 1); assert.strictEqual(doc.getPageCount(), 1);
if (!fitzAvailable()) {
t.skip('PyMuPDF (fitz) not available; skipping PDF text assertions');
return;
}
const text = extractPdfText(bytes); const text = extractPdfText(bytes);
assert.ok(text.includes('CIS 2101'), 'PDF text should contain course code CIS 2101'); assert.ok(text.includes('CIS 2101'), 'PDF text should contain course code CIS 2101');
assert.ok(text.includes("STUDENT'S STUDY LOAD"), 'PDF text should contain the title'); assert.ok(text.includes("STUDENT'S STUDY LOAD"), 'PDF text should contain the title');