-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuildspec.yml
More file actions
41 lines (40 loc) · 2.2 KB
/
buildspec.yml
File metadata and controls
41 lines (40 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
version: 0.2
phases:
install:
runtime-versions:
python: 3.9
commands:
- aws s3 cp s3://stdiff/dvc/binary/dvc_2.8.3_amd64.deb /tmp/dvc_2.8.3_amd64.deb
- dpkg -i /tmp/dvc_2.8.3_amd64.deb
- dvc pull
- curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- export PATH=/root/.local/bin:$PATH
- poetry env use system
- poetry install
- export VERSION=$(poetry version -s).$CODEBUILD_BUILD_NUMBER
- poetry version $VERSION # this sets the version of the wheel file
pre_build:
commands:
- poetry run black --check */*.py */*/*.py
- dvc status -q # If the pipeline is not up to date, the build is failed.
- poetry run pytest # unit test
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
build:
commands:
- poetry build
- docker build --build-arg VERSION=$VERSION -t emo-classifier:$VERSION .
- docker tag emo-classifier:$VERSION $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$VERSION
- poetry run pytest test/integration/test_api_server.py # integration test
post_build:
commands:
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$VERSION
- export POETRY_HTTP_BASIC_STDIFF_USERNAME=aws
- export POETRY_HTTP_BASIC_STDIFF_PASSWORD=$(aws codeartifact get-authorization-token --domain-owner $AWS_ACCOUNT_ID --domain stdiff --query 'authorizationToken' --output text)
- poetry config repositories.stdiff $(aws codeartifact get-repository-endpoint --domain-owner $AWS_ACCOUNT_ID --domain stdiff --repository stdiff --format pypi --query repositoryEndpoint --output text)
- poetry publish -r stdiff
- cp notebook/error_analysis.html dist/error_analysis-$VERSION.html
- mv dist $VERSION
artifacts:
files:
- $VERSION/emo_classifier-*-py3-none-any.whl
- $VERSION/error_analysis-$VERSION.html