-
Notifications
You must be signed in to change notification settings - Fork 25
176 lines (171 loc) · 6.76 KB
/
schema-version-bump.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Schema Version Bump Workflow
on:
workflow_dispatch:
inputs:
is-major-schema-bump:
description: "Set to 'true' to kickoff major schema update; otherwise trigger a minor schema update"
required: true
default: 'false'
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
ontology-dry-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Python cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r scripts/schema_bump_dry_run_ontologies/requirements.txt
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_PROD_ROLE_TO_ASSUME }}
role-duration-seconds: 2700
- name: Pull AWS Secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids:
AUTH0_SECRETS, corpora/backend/prod/auth0-secret
- name: Run Dry-Run Script
run: python3 -m scripts.schema_bump_dry_run_ontologies.ontology_bump_dry_run
env:
corpus_env: "prod"
- name: Store JSON with Replaced By Ontology Term Mappings
uses: actions/cache/save@v4
with:
path: "./replaced-by.json"
key: replaced-by-map
- name: upload dry run to slack
run: |
curl -F [email protected] -F "initial_comment=Ontology Dry Run Report" -F channels=${{secrets.SLACK_CURATOR_REPORTING_CHANNEL}} -H "Authorization: Bearer ${{secrets.SLACK_CURATOR_REPORTING_APP_AUTH}}" https://slack.com/api/files.upload
gencode-dry-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Python cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r scripts/schema_bump_dry_run_genes/requirements.txt
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_PROD_ROLE_TO_ASSUME }}
role-duration-seconds: 2700
- name: Pull AWS Secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids:
AUTH0_SECRETS, corpora/backend/prod/auth0-secret
- name: Check if any GENCODE csv files have changed
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: cellxgene_schema_cli/cellxgene_schema/gencode_files/*.csv.gz
- name: Run Dry-Run Script
if: steps.changed-files.outputs.any_changed == 'true'
run: python3 -m scripts.schema_bump_dry_run_genes.gene_bump_dry_run
env:
corpus_env: "prod"
- name: upload to slack
if: steps.changed-files.outputs.any_changed == 'true'
run: |
curl -F [email protected] -F "initial_comment=Gene Dry Run Report" -F channels=${{secrets
.SLACK_CURATOR_REPORTING_CHANNEL}} -H "Authorization: Bearer ${{secrets.SLACK_CURATOR_REPORTING_APP_AUTH}}" https://slack.com/api/files.upload
generate-conversion-script:
runs-on: ubuntu-latest
needs: ontology-dry-run
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }} # checking out the last commit to this branch
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Python cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r scripts/migration_assistant/requirements.txt
- name: Retrieve Replaced By Ontology Term Mapping
uses: actions/cache/restore@v4
with:
path: ./replaced-by.json
key: replaced-by-map
- name: Run Conversion Script Generator
run: |
make generate-conversion-script
- name: Get Version
id: get_version
run: |
echo "old_version=$(make show-current-version)" >> $GITHUB_ENV
- name: setup git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: remove diff files
run: |
git rm --ignore-unmatch ./cellxgene_schema_cli/cellxgene_schema/gencode_files/*_diff.txt
- name: Bump Patch Version
if: ${{ github.event.inputs.is-major-schema-bump }} == 'false'
run: |
pip install bumpversion
pip install wheel
bumpversion --config-file .bumpversion.cfg minor --allow-dirty
bumpversion --config-file .bumpversion.cfg prerel --allow-dirty --tag
echo "new_version=$(make show-current-version)" >> $GITHUB_ENV
- name: Bump RC to Major Version
if: ${{ github.event.inputs.is-major-schema-bump }} == 'true'
run: |
pip install bumpversion
pip install wheel
bumpversion --config-file .bumpversion.cfg major --allow-dirty
bumpversion --config-file .bumpversion.cfg prerel --allow-dirty --tag
echo "new_version=$(make show-current-version)" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'AUTO: update migrate.py schema_version ${{ env.old_version }}->${{ env.new_version }}'
title: 'AUTO: update migrate.py schema_version ${{ env.old_version }}->${{ env.new_version }}'
body: 'This is an automated PR to update migrate.py from schema_version ${{ env.old_version }}->${{ env.new_version }}.'
branch: auto/update-convert-py-to-${{ env.new_version }}
base: main
reviewers: ${{ vars.MIGRATION_REVIEWERS }}
add-paths: |
cellxgene_schema_cli/setup.py
cellxgene_schema_cli/cellxgene_schema/__init__.py
cellxgene_schema_cli/cellxgene_schema/migrate.py
.bumpversion.cfg