GHA to test census compatibility #813
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
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@v3 | |
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 |