Skip to content

Commit

Permalink
Merge branch 'main' into versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
melissawm authored Jan 15, 2025
2 parents 420d167 + d873866 commit 1496f41
Show file tree
Hide file tree
Showing 128 changed files with 5,809 additions and 2,164 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/client-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
branches:
- main
paths:
- 'client/python/**'
- '.github/workflows/client-python.yml'
- "client/python/**"
- ".github/workflows/client-python.yml"
pull_request:
branches:
- '**'
- "**"
paths:
- 'client/python/**'
- '.github/workflows/client-python.yml'
- "client/python/**"
- ".github/workflows/client-python.yml"

jobs:
test-client-python:
Expand All @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout Repo
Expand All @@ -46,11 +46,14 @@ jobs:
make coverage
- name: Upload Coverage
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: ./client/python/cryoet_data_portal/.coverage*
retention-days: 3
include-hidden-files: true
- name: Verify Coverage Files
run: ls -la ./client/python/cryoet_data_portal

submit-codecoverage:
needs:
Expand All @@ -63,15 +66,21 @@ jobs:
fetch-depth: 0

- name: Download Coverage
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: coverage
path: .
path: ./coverage

- name: Verify Coverage Artifacts
run: ls -R ./coverage

- name: Move Coverage Files
run: |
find ./coverage -type f -name ".coverage*" -exec mv {} . \;
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.12"

- name: Install Requirements
run: |
Expand Down
153 changes: 133 additions & 20 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,77 @@ on:
delete:
branches:
- 'dev-*'
pull_request:
types: [labeled, unlabeled, synchronize, closed]

# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
permissions:
id-token: write
contents: read
id-token: write
pull-requests: write

jobs:
deploy-to-dev:
name: deploy dev branch
runs-on: ubuntu-latest
environment: dev
if: github.repository == 'chanzuckerberg/cryoet-data-portal'
if: |
github.repository == 'chanzuckerberg/cryoet-data-portal' && (
github.event_name != 'pull_request' || (
startsWith(github.head_ref, 'dev-') != true && (
contains(github.event.pull_request.labels.*.name, 'preview') || (
github.event.action == 'unlabeled' &&
github.event.label.name == 'preview'
)
)
)
)
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- id: deploy-data
name: get stack name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const event = ${{ toJson(github.event) }}
const eventName = '${{ github.event_name }}'
let name = ''
switch (eventName) {
case 'pull_request': {
name = event.pull_request.head.ref
break
}
default: {
name = event.ref.replace('refs/heads/', '')
break
}
}
return name.replaceAll('/', '-').slice(0, 25)
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
mask-aws-account-id: true
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 1200
- name: Setting up stack name
run: |
if [[ ${#GITHUB_REF_NAME} -gt 25 ]]; then
echo "branch name: ${GITHUB_REF_NAME}, length ${#GITHUB_REF_NAME}, is $((${#GITHUB_REF_NAME} - 25)) characters too long, please use a branch name that's 25 characters or shorter"
exit 1
else
echo $GITHUB_REF_NAME | tr '[:upper:]' '[:lower:]' | xargs -I {} -n 1 echo STACK_NAME={} >> $GITHUB_ENV
fi

- name: Create or update dev stack
if: ${{ github.event_name == 'push' }}
if: |
github.event_name == 'push' || (
github.event_name == 'pull_request' && (
github.event.action == 'labeled' ||
github.event.action == 'synchronize'
)
)
uses: chanzuckerberg/github-actions/.github/actions/[email protected]
env:
# Force using BuildKit instead of normal Docker, required so that metadata
Expand All @@ -46,31 +87,103 @@ jobs:
DOCKER_REPO: ${{ secrets.ECR_REPO }}/
ENV: dev
with:
stack-name: ${{ env.STACK_NAME }}
stack-name: ${{ steps.deploy-data.outputs.result }}
create-tag: true
tfe-token: ${{ secrets.TFE_TOKEN }}
working-directory: ./frontend
env: dev
operation: create-or-update

- name: Annotate workflow run with frontend URL
if: ${{ github.event_name == 'push' }} && success()
if: |
github.event_name == 'push' || (
github.event_name == 'pull_request' && (
github.event.action == 'labeled' ||
github.event.action == 'synchronize'
)
)
run: |
echo "# Frontend URL:" >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo "https://${{ env.STACK_NAME }}.cryoet.dev.si.czi.technology" >> $GITHUB_STEP_SUMMARY
echo "https://${{ steps.deploy-data.outputs.result }}.cryoet.dev.si.czi.technology" >> $GITHUB_STEP_SUMMARY
- id: find-comment
name: Find PR comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: 'Frontend Preview URL'

- id: get-comment-date
name: Get PR comment updated date
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const date = new Date()
const options = {
month: '2-digit',
day: '2-digit',
year: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: true,
};
const pstDate = date.toLocaleString('en-US', { timeZone: 'America/Los_Angeles', ...options });
return pstDate.replace(',', ' @');
- name: Post comment on PR
if: |
github.event_name == 'pull_request' && (
github.event.action == 'labeled' ||
github.event.action == 'synchronize'
)
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id}}
issue-number: ${{ github.event.pull_request.number}}
edit-mode: replace
body: |
# Frontend Preview URL
https://${{ steps.deploy-data.outputs.result }}.cryoet.dev.si.czi.technology
Updated: ${{ steps.get-comment-date.outputs.result }} PST
- name: Delete PR comment
if: |
github.event_name == 'pull_request' && (
github.event.action == 'unlabeled' ||
github.event.action == 'closed'
) &&
steps.find-comment.outputs.comment-id != ''
uses: actions/github-script@v7
with:
script: |
github.rest.issues.deleteComment({
comment_id: ${{ steps.find-comment.outputs.comment-id }},
owner: context.repo.owner,
repo: context.repo.repo,
})
- name: Delete dev set up stack name
if: ${{ github.event_name == 'delete' && startsWith(github.event.ref, 'dev-') }}
run: |
echo ${{ github.event.ref }} | tr '[:upper:]' '[:lower:]' | xargs -I {} -n 1 echo DELETE_STACK_NAME={} >> $GITHUB_ENV
- name: Delete dev
if: ${{ github.event_name == 'delete' && startsWith(github.event.ref, 'dev-') }}
if: |
github.event_name == 'delete' || (
github.event_name == 'pull_request' && (
github.event.action == 'unlabeled' ||
github.event.action == 'closed'
)
)
uses: chanzuckerberg/github-actions/.github/actions/[email protected]
env:
ENV: dev
with:
stack-name: ${{ env.DELETE_STACK_NAME }}
stack-name: ${{ steps.deploy-data.outputs.result }}
operation: delete
tfe-token: ${{ secrets.TFE_TOKEN }}
env: dev
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/docsite-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ name: Build and Deploy Docsite
on:
workflow_dispatch: # Used to make post-release docfixes
push:
tags-ignore:
- 'frontend-*'
branches:
- main
paths:
- 'docs/**'

permissions:
contents: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ dmypy.json

.idea
.terraform
.DS_Store

# Files specific to this repo
webdav_settings.json
12 changes: 12 additions & 0 deletions client/python/cryoet_data_portal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [4.3.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/cryoet-data-portal-python-client-v4.2.1...cryoet-data-portal-python-client-v4.3.0) (2024-12-19)


### ✨ Features

* add size fields to TiltSeries ([#1406](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1406)) ([3b8e709](https://github.com/chanzuckerberg/cryoet-data-portal/commit/3b8e709a5d44be4085be54c780723fb6910fb521))


### 🧹 Miscellaneous Chores

* update python matrix ([#1407](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1407)) ([639cd90](https://github.com/chanzuckerberg/cryoet-data-portal/commit/639cd901ca4c0def4baa1bdd6e8bd1aeb011a46e))

## [4.2.1](https://github.com/chanzuckerberg/cryoet-data-portal/compare/cryoet-data-portal-python-client-v4.2.0...cryoet-data-portal-python-client-v4.2.1) (2024-12-06)


Expand Down
2 changes: 1 addition & 1 deletion client/python/cryoet_data_portal/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cryoet_data_portal"
version = "4.2.1"
version = "4.3.0"
description = "API Client to facilitate the use of the CryoET Portal. For more information about the API and the project visit https://github.com/chanzuckerberg/cryoet-data-portal/"
authors = [
{ name = "Chan Zuckerberg Initiative", email = "[email protected]" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
TomogramVoxelSpacing,
)

__version__ = "4.2.1"
__version__ = "4.3.0"

__all__ = [
"Client",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,9 @@ class TiltSeries(Model):
is_aligned (bool): Whether this tilt series is aligned
pixel_spacing (float): Pixel spacing equal in both axes in angstroms
aligned_tiltseries_binning (int): Binning factor of the aligned tilt series
size_x (int): Number of pixels in the 3D data fast axis
size_y (int): Number of pixels in the 3D data medium axis
size_z (int): Number of pixels in the 3D data slow axis
"""

_gql_type: str = "Tiltseries"
Expand Down Expand Up @@ -1403,6 +1406,9 @@ class TiltSeries(Model):
is_aligned: bool = BooleanField()
pixel_spacing: float = FloatField()
aligned_tiltseries_binning: int = IntField()
size_x: int = IntField()
size_y: int = IntField()
size_z: int = IntField()

@classmethod
def find(
Expand Down
Loading

0 comments on commit 1496f41

Please sign in to comment.