Skip to content

Commit 09b1b7f

Browse files
authored
Merge branch 'master' into add_files_endpoint
2 parents 802ec4c + 14a63db commit 09b1b7f

File tree

158 files changed

+7474
-8856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+7474
-8856
lines changed

.docker/docker_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"debug": true,
3+
"page_limit": 5,
34
"default_db": "test_server",
45
"base_url": "http://gh_actions_host:3213",
56
"implementation": {

.github/dependabot.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,26 @@ updates:
88
time: "05:43"
99
# Needs to be larger than the number of total requirements (currently 31)
1010
open-pull-requests-limit: 50
11-
target-branch: dependabot_updates
11+
target-branch: master
1212
labels:
1313
- dependency_updates
1414
# Turn off automatic rebases so that auto-merge can work without needed N**2 CI runs
1515
rebase-strategy: "disabled"
16+
ignore:
17+
- dependency-name: "elasticsearch*"
18+
versions: [ ">=8" ]
19+
- dependency-name: "jarvis-tools"
20+
versions: [ "==2024.4.20", "==2024.4.30" ]
21+
groups:
22+
python-dependencies:
23+
applies-to: version-updates
24+
dependency-type: production
25+
python-dependencies-dev:
26+
applies-to: version-updates
27+
dependency-type: development
28+
python-dependencies-security:
29+
applies-to: security-updates
30+
dependency-type: production
1631
- package-ecosystem: gitsubmodule
1732
directory: "/"
1833
schedule:
@@ -26,6 +41,10 @@ updates:
2641
schedule:
2742
interval: daily
2843
time: "05:33"
29-
target-branch: dependabot_updates
44+
target-branch: master
3045
labels:
3146
- CI
47+
groups:
48+
github-actions:
49+
applies-to: version-updates
50+
dependency-type: production

.github/fly.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# fly.toml file generated for broken-field-1976 on 2022-11-21T21:37:55Z
2-
31
app = "optimade"
42
kill_signal = "SIGINT"
53
kill_timeout = 5
6-
processes = []
4+
swap_size_mb = 1024
5+
processes = {}
6+
7+
[build]
8+
builder = "paketobuildpacks/builder:base"
79

810
[env]
11+
PORT = "5000"
12+
BPE_OPTIMADE_CONFIG_FILE = "./tests/test_config.json"
13+
BPL_OPTIMADE_CONFIG_FILE = "./tests/test_config.json"
14+
OPTIMADE_CONFIG_FILE = "./tests/test_config.json"
915

1016
[experimental]
1117
allowed_public_ports = []

.github/utils/single_dependency_pr_body.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/cd_container_image.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@ jobs:
2020
if: github.repository_owner == 'Materials-Consortia'
2121
runs-on: ubuntu-latest
2222

23-
env:
24-
IMAGE_NAME: optimade
23+
environment:
24+
name: container-image
25+
url: https://github.com/${{ github.repository }}/pkgs/container/${{ vars.IMAGE_NAME }}
2526

2627
steps:
2728
- name: Checkout repository
28-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
2930
with:
3031
fetch-depth: 0
3132
submodules: true
3233
ref: ${{ inputs.checkout_ref }}
3334

3435
- name: Retrieve version
36+
id: get_version
3537
run: |
3638
# Get current OPTIMADE version from optimade/__init__.py
3739
regex="^__version__ = (\"|')(.*)(\"|')$"
@@ -41,61 +43,63 @@ jobs:
4143
fi
4244
done < optimade/__init__.py
4345
44-
echo "VERSION=${VERSION}" >> $GITHUB_ENV
46+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4547
echo VERSION=${VERSION}
4648
4749
- name: Set source ref
50+
id: set_source_ref
4851
run: |
4952
if [[ "${{ inputs.release }}" == "true" ]]; then
5053
# Use tag for metadata instead of commit SHA
51-
SOURCE_REF=v${{ env.VERSION }}
54+
SOURCE_REF=v${{ steps.get_version.outputs.version }}
5255
else
5356
SOURCE_REF=$(git rev-parse HEAD)
5457
fi
5558
56-
echo "SOURCE_REF=${SOURCE_REF}" >> $GITHUB_ENV
59+
echo "source_ref=${SOURCE_REF}" >> $GITHUB_OUTPUT
5760
echo SOURCE_REF=${SOURCE_REF}
5861
5962
- name: Build image
6063
run: |
6164
docker build \
6265
--file Dockerfile \
63-
--tag "${IMAGE_NAME}" \
66+
--tag "${{ vars.IMAGE_NAME }}" \
6467
--label "gh_actions_runnumber=${GITHUB_RUN_ID}" \
6568
--label "org.openctonainers.image.title=OPTIMADE" \
6669
--label "org.opencontainers.image.description=A server implementation for serving an OPTIMADE API." \
67-
--label "org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ env.SOURCE_REF }}" \
68-
--label "org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/${{ env.SOURCE_REF }}/README.md" \
70+
--label "org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ steps.set_source_ref.outputs.source_ref }}" \
71+
--label "org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/${{ steps.set_source_ref.outputs.source_ref }}/README.md" \
6972
--label "org.opencontainers.image.licenses=MIT" \
70-
--label "org.opencontainers.image.url=https://github.com/${{ github.repository }}/pkgs/container/${IMAGE_NAME}" \
73+
--label "org.opencontainers.image.url=https://github.com/${{ github.repository }}/pkgs/container/${{ vars.IMAGE_NAME }}" \
7174
--label "org.opencontainers.image.vendor=${{ github.repository_owner }}" \
72-
--label "org.opencontainers.image.version=${{ env.VERSION }}" \
75+
--label "org.opencontainers.image.version=${{ steps.get_version.outputs.version }}" \
7376
--label "org.opencontainers.image.base.name=docker.io/library/python:3.10-slim" \
7477
.
7578
7679
- name: Create full image ID and tag with 'develop'
80+
id: create_tags
7781
run: |
78-
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}
82+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}
7983
8084
# Change all uppercase to lowercase
8185
IMAGE_ID=$(echo ${IMAGE_ID} | tr '[A-Z]' '[a-z]')
8286
83-
echo "IMAGE_ID=${IMAGE_ID}" >> $GITHUB_ENV
87+
echo "image_id=${IMAGE_ID}" >> $GITHUB_OUTPUT
8488
echo IMAGE_ID=${IMAGE_ID}
8589
8690
# Tag with "develop"
87-
docker tag ${IMAGE_NAME} ${IMAGE_ID}:develop
91+
docker tag ${{ vars.IMAGE_NAME }} ${IMAGE_ID}:develop
8892
8993
- name: Tag with version and `latest` - if it's a release
9094
if: inputs.release
9195
run: |
92-
docker tag ${IMAGE_NAME} ${{ env.IMAGE_ID }}:${{ env.VERSION }}
93-
docker tag ${IMAGE_NAME} ${{ env.IMAGE_ID }}:latest
96+
docker tag ${{ vars.IMAGE_NAME }} ${{ steps.create_tags.outputs.image_id }}:${{ steps.get_version.outputs.version }}
97+
docker tag ${{ vars.IMAGE_NAME }} ${{ steps.create_tags.outputs.image_id }}:latest
9498
9599
- name: Log in to registry
96100
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
97101

98102
- name: Push image
99103
run: |
100-
docker image inspect ${IMAGE_NAME}
101-
docker push --all-tags ${{ env.IMAGE_ID }}
104+
docker image inspect ${{ vars.IMAGE_NAME }}
105+
docker push --all-tags ${{ steps.create_tags.outputs.image_id }}

.github/workflows/cd_release.yml

Lines changed: 87 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,46 @@ on:
66
- published
77

88
env:
9-
PUBLISH_UPDATE_BRANCH: master
109
GIT_USER_NAME: OPTIMADE Developers
1110
GIT_USER_EMAIL: "[email protected]"
11+
DEFAULT_RELEASE_BRANCH: "master"
1212

1313
jobs:
14-
15-
publish:
16-
name: Publish OPTIMADE Python tools
14+
release:
15+
name: Release OPTIMADE Python tools
1716
runs-on: ubuntu-latest
1817
if: github.repository == 'Materials-Consortia/optimade-python-tools' && startsWith(github.ref, 'refs/tags/v')
18+
outputs:
19+
publish_branch: ${{ steps.save_branch.outputs.publish_branch }}
1920

2021
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v3
22+
- name: Get triggering branch
23+
uses: octokit/[email protected]
24+
id: get_release_branch
25+
with:
26+
route: GET /repos/{owner}/{repo}/releases/tags/${{ github.ref_name }}
27+
# Note, the following inputs might give warnings that they are not valid.
28+
# This is due to the flexible nature of the `octokit/request-action`.
29+
# Fore more information see: https://github.com/octokit/request-action/tree/v2.x?tab=readme-ov-file#warnings
30+
owner: Materials-Consortia
31+
repo: optimade-python-tools
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Save branch name
36+
id: save_branch
37+
run: |
38+
echo 'publish_branch=${{ fromJson(steps.get_release_branch.outputs.data).target_commitish }}' >> $GITHUB_OUTPUT
39+
40+
- name: Checkout publish branch
41+
uses: actions/checkout@v4
2342
with:
2443
submodules: true
2544
fetch-depth: 0
45+
ref: ${{ steps.save_branch.outputs.publish_branch }}
2646

2747
- name: Set up Python 3.10
28-
uses: actions/setup-python@v4
48+
uses: actions/setup-python@v5
2949
with:
3050
python-version: '3.10'
3151

@@ -36,70 +56,98 @@ jobs:
3656
pip install -r requirements.txt -r requirements-dev.txt -r requirements-client.txt -r requirements-http-client.txt -r requirements-docs.txt
3757
pip install -e .[all]
3858
59+
- name: Setup changelog configuration
60+
id: changelog_config
61+
run: |
62+
echo "project=$(echo $GITHUB_REPOSITORY | cut -d/ -f2- )" >> $GITHUB_OUTPUT
63+
echo "exclude_labels=duplicate,question,invalid,wontfix,dependency_updates,skip_changelog" >> $GITHUB_OUTPUT
64+
65+
# For the release-specific changelog
66+
echo "output_file=release_changelog.md" >> $GITHUB_OUTPUT
67+
3968
- name: Update changelog
40-
uses: CharMixer/auto-changelog-action@v1
69+
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
4170
with:
42-
token: ${{ secrets.RELEASE_PAT_BOT }}
43-
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
44-
exclude_labels: "duplicate,question,invalid,wontfix,dependency_updates,skip_changelog"
71+
args: --user "${{ github.repository_owner }}" --project "${{ steps.changelog_config.outputs.project }}" --token "${{ secrets.RELEASE_PAT_BOT }}" --release-branch "${{ steps.save_branch.outputs.publish_branch }}" --exclude-labels "${{ steps.changelog_config.outputs.exclude_labels }}"
4572

4673
- name: Update API Reference docs and version - Commit changes and update tag
4774
run: .github/utils/update_docs.sh
4875

49-
- name: Update '${{ env.PUBLISH_UPDATE_BRANCH }}'
76+
- name: Update triggering branch
5077
uses: CasperWA/push-protected@v2
5178
with:
5279
token: ${{ secrets.RELEASE_PAT_BOT }}
53-
branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
80+
branch: ${{ steps.save_branch.outputs.publish_branch }}
5481
unprotect_reviews: true
5582
sleep: 15
5683
force: true
5784
tags: true
5885

59-
- name: Get tagged versions
60-
run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_ENV
86+
- name: Get previous version
87+
id: get_previous_version
88+
run: echo "previous_version=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_OUTPUT
6189

6290
- name: Create release-specific changelog
63-
uses: CharMixer/auto-changelog-action@v1
91+
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
6492
with:
65-
token: ${{ secrets.RELEASE_PAT_BOT }}
66-
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
67-
since_tag: "${{ env.PREVIOUS_VERSION }}"
68-
output: "release_changelog.md"
69-
exclude_labels: "duplicate,question,invalid,wontfix,dependency_updates,skip_changelog"
93+
args: --user "${{ github.repository_owner }}" --project "${{ steps.changelog_config.outputs.project }}" --token "${{ secrets.RELEASE_PAT_BOT }}" --release-branch "${{ steps.save_branch.outputs.publish_branch }}" --since-tag "${{ steps.get_previous_version.outputs.previous_version }}" --output "${{ steps.changelog_config.outputs.output_file }}" --usernames-as-github-logins --exclude-labels "${{ steps.changelog_config.outputs.exclude_labels }}"
7094

7195
- name: Append changelog to release body
7296
run: |
7397
gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} --jq '.body' > release_body.md
74-
cat release_changelog.md >> release_body.md
98+
cat ${{ steps.changelog_config.outputs.output_file }} >> release_body.md
7599
gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} -X PATCH -F body='@release_body.md'
76100
env:
77101
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT_BOT }}
78102

103+
publish-to-pypi:
104+
name: Publish to PyPI
105+
needs: release
106+
runs-on: ubuntu-latest
107+
108+
environment:
109+
name: pypi
110+
url: https://pypi.org/p/optimade
111+
112+
permissions:
113+
id-token: write # Important for Trusted Publishing on PyPI
114+
115+
steps:
116+
- name: Install prerequisites
117+
run: python -m pip install build
118+
119+
- name: Checkout repository
120+
uses: actions/checkout@v4
121+
with:
122+
submodules: true
123+
fetch-depth: 0
124+
ref: ${{ needs.release.outputs.publish_branch }}
125+
79126
- name: Build source distribution
80127
run: python -m build
81128

82129
- name: Publish package to PyPI
83130
uses: pypa/gh-action-pypi-publish@release/v1
84131
with:
85-
user: __token__
86-
password: ${{ secrets.PYPI_PASSWORD }}
132+
print-hash: true
87133

88134
docs:
89135
name: Deploy documentation
90-
needs: publish
136+
needs:
137+
- release
138+
- publish-to-pypi
91139
runs-on: ubuntu-latest
92140

93141
steps:
94142
- name: Checkout repository
95-
uses: actions/checkout@v3
143+
uses: actions/checkout@v4
96144
with:
97145
submodules: true
98146
fetch-depth: 0
99-
ref: ${{ env.PUBLISH_UPDATE_BRANCH }}
147+
ref: ${{ needs.release.outputs.publish_branch }}
100148

101149
- name: Set up Python 3.10
102-
uses: actions/setup-python@v4
150+
uses: actions/setup-python@v5
103151
with:
104152
python-version: '3.10'
105153

@@ -115,18 +163,25 @@ jobs:
115163
git config --global user.name "${{ env.GIT_USER_NAME }}"
116164
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
117165
118-
- name: Deploy documentation
166+
- name: Deploy versioned documentation
167+
run: |
168+
mike deploy --push --remote origin --branch gh-pages --config-file mkdocs.yml ${GITHUB_REF#refs/tags/v}
169+
170+
- name: Deploy stable/latest documentation
171+
if: ${{ needs.release.outputs.publish_branch }} == ${{ env.DEFAULT_RELEASE_BRANCH }}
119172
run: |
120173
mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml ${GITHUB_REF#refs/tags/v} stable
121-
mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest master
174+
mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest ${{ env.DEFAULT_RELEASE_BRANCH }}
122175
123176
publish_container_image:
124177
name: Publish container image
125-
needs: publish
178+
needs:
179+
- release
180+
- publish-to-pypi
126181
uses: ./.github/workflows/cd_container_image.yml
127182
with:
128183
release: true
129-
checkout_ref: master
184+
checkout_ref: ${{ needs.release.outputs.publish_branch }}
130185
secrets: inherit
131186
permissions:
132187
packages: write

0 commit comments

Comments
 (0)