-
Notifications
You must be signed in to change notification settings - Fork 22
93 lines (77 loc) · 2.64 KB
/
py-build.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Python cell_census build
on:
pull_request:
paths:
- "api/python/**"
- "tools/cellxgene_census_builder/**"
- ".github/workflows/**" # Re-run if a workflow is modified - useful to test workflow changes in PRs
push:
branches: [main]
workflow_dispatch:
jobs:
build_python_wheels:
name: Build Python wheel and sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install deps
run: |
python -m pip install -U pip setuptools build
- name: Build
run: python -m build
working-directory: api/python/cellxgene_census/
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
path: api/python/cellxgene_census/dist/*
build_docker_container:
name: Build Docker image for Census Builder
runs-on: ubuntu-latest
permissions: # these permissions must be set for AWS auth to work!
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_PROD_ROLE_TO_ASSUME }}
role-session-name: PushDockerImage
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Install deps
run: |
python -m pip install -U pip setuptools build
- name: Build package
run: python -m build
working-directory: tools/cellxgene_census_builder/
- name: Build and tag docker image to Amazon ECR
env:
REGISTRY: ${{ secrets.ECR_PROD_REGISTRY }}
REPOSITORY: cellxgene-census-builder
run: |
GIT_SHA=$(git rev-parse --short HEAD)
docker build --build-arg=COMMIT_SHA=$GIT_SHA -t $REGISTRY/$REPOSITORY:$GIT_SHA .
working-directory: tools/cellxgene_census_builder/
- name: Push docker image to Amazon ECR
if: ${{ github.ref == 'refs/heads/main' }}
env:
REGISTRY: ${{ secrets.ECR_PROD_REGISTRY }}
REPOSITORY: cellxgene-census-builder
run: |
GIT_SHA=$(git rev-parse --short HEAD)
docker push $REGISTRY/$REPOSITORY:$GIT_SHA
docker tag $REGISTRY/$REPOSITORY:$GIT_SHA $REGISTRY/$REPOSITORY:latest
docker push $REGISTRY/$REPOSITORY:latest