Compare commits

...

3 Commits

Author SHA1 Message Date
andrei efe8fe173d remove travis 5 years ago
andrei 461fa909a4 ci: add ability to publish 5 years ago
andrei da261014e1 ci: add pipeline file 5 years ago
  1. 69
      .ci/pipeline.ts
  2. 20
      .travis.yml

69
.ci/pipeline.ts

@ -0,0 +1,69 @@
import {
Job,
pushStep,
spawnChildJob,
} from "https://pkg.buildyboi.ci/buildy/[email protected]/mod.ts";
import * as Docker from "https://pkg.buildyboi.ci/buildy/[email protected]/mod.ts";
import { readSecrets } from "https://pkg.buildyboi.ci/buildy/[email protected]/secrets.ts";
async function getImage(version: string): Promise<string> {
const dockerFileTemplate = `
FROM python:${version}-buster
ADD requirements.txt .
RUN pip install -r requirements.txt flake8 twine
`;
const image = await Docker.buildImage({
dockerfileContents: dockerFileTemplate,
include: ["requirements.txt"],
});
return image.id;
}
export async function runTests(job: Job) {
const imageId = await getImage(job.args.version);
pushStep("Tests");
await Docker.run(`python setup.py test`, {
image: imageId,
});
pushStep("Flake8");
await Docker.run(`flake8 disco/`, {
image: imageId,
});
}
const versionMatrix = ["3.8", "3.7", "3.6"];
export async function run(job: Job) {
for (const version of versionMatrix) {
await spawnChildJob(`.ci/pipeline.ts:runTests`, {
args: {
version: version,
},
alias: `Test Python ${version}`,
});
}
}
export async function runRelease(job: Job) {
const imageId = await getImage("3.8");
const [twineUsername, twinePassword] = await readSecrets(
"TWINE_USERNAME",
"TWINE_PASSWORD"
);
await Docker.run(`python setup.py sdist`, {
image: imageId,
});
await Docker.run(`python3 -m twine upload dist/*`, {
image: imageId,
env: [`TWINE_USERNAME=${twineUsername}`, `TWINE_PASSWORD=${twinePassword}`],
});
}

20
.travis.yml

@ -1,20 +0,0 @@
language: python
cache: pip
python:
- '2.7'
- '3.6'
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
install:
- pip install -U pip setuptools flake8
script:
- python setup.py test
- flake8 disco/
Loading…
Cancel
Save