Skip to content

Fix initially blank mutations #188

Fix initially blank mutations

Fix initially blank mutations #188

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [main, test]
permissions:
contents: read
issues: write
pull-requests: write
jobs:
pre-commit:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: pre-commit/[email protected]
test:
name: Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [ "3.11" ]
os: [ ubuntu-latest, ]
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install deps
run: pip install -r requirements.txt
- name: Tests with numba
run: coverage run --source=tsbrowse -m pytest -x tests
- name: Tests with coverage (no numba)
run: TSBROWSE_DISABLE_NUMBA=1 coverage run --source=tsbrowse -m pytest -x tests
- name: Create Screenshot
run: |
msp simulate --length 1000 --recombination-rate 0.01 --mutation-rate 0.01 100 out.trees
python -m tsbrowse preprocess out.trees
python -m tsbrowse screenshot out.tsbrowse mutations
python -m tsbrowse screenshot out.tsbrowse edges
python -m tsbrowse screenshot out.tsbrowse nodes
- name: Upload Screenshot Artifact
uses: actions/upload-artifact@v3
with:
name: screenshots
path: "*.png"
- name: Post Screenshots to PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const path = process.env.GITHUB_WORKSPACE;
const screenshotDir = path;
const imageFiles = fs.readdirSync(screenshotDir).filter(file => file.endsWith('.png'));
if (imageFiles.length > 0) {
let imagesMarkdown = '';
for (const file of imageFiles) {
const filePath = `${screenshotDir}/${file}`;
const imageData = fs.readFileSync(filePath, { encoding: 'base64' });
imagesMarkdown += `![${file}](data:image/png;base64,${imageData})\n`;
}
const body = `<details><summary>PR Screenshots</summary>\n${imagesMarkdown}\n</details>`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
}
- name: Upload coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github