Compare commits
3 Commits
master
...
ci/buildyb
Author | SHA1 | Date |
---|---|---|
|
efe8fe173d | 5 years ago |
|
461fa909a4 | 5 years ago |
|
da261014e1 | 5 years ago |
2 changed files with 69 additions and 20 deletions
@ -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}`], |
||||
|
}); |
||||
|
} |
@ -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…
Reference in new issue