Skip to content

Commit

Permalink
Merge pull request #238 from naik-aakash/combine_workflows
Browse files Browse the repository at this point in the history
Misc CI workflow improvements
  • Loading branch information
naik-aakash authored Nov 14, 2024
2 parents a2eee90 + 0f6e6dd commit aea4326
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 197 deletions.
46 changes: 43 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
types: [ created ] # Runs only when a new release is created

jobs:
build:
build-image:
runs-on: ubuntu-latest
if: github.repository_owner == 'autoatml' && github.ref == 'refs/heads/main'
permissions:
contents: read
contents: write
packages: write
pull-requests: write
attestations: write
id-token: write
strategy:
Expand Down Expand Up @@ -51,3 +51,43 @@ jobs:
- name: Push Docker image to GHCR (Python ${{ matrix.python-version }})
run: |
docker push ghcr.io/${{ env.IMAGE_NAME }}/autoplex-python-${{ matrix.python-version }}:${{ env.VERSION }}
update-devcontainer:
if: github.repository_owner == 'autoatml' && github.ref == 'refs/heads/main'
needs: build-image
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Update devcontainer.json with new version
run: |
TAG=$(curl -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/orgs/autoatml/packages/container/autoplex%2Fautoplex-python-3.10/versions \
| jq -r 'sort_by(.created_at) | reverse | .[0].metadata.container.tags[0]')
# Debug the version extracted
echo "Extracted TAG: $TAG"
# Update the version in devcontainer.json
# Using the escaped version to safely substitute in the JSON file
sed -i -E "s|ghcr.io/autoatml/autoplex/autoplex-python-3.10:[^\"]*|ghcr.io/autoatml/autoplex/autoplex-python-3.10:$TAG|" .devcontainer/devcontainer.json
echo "Updated devcontainer.json with version $TAG"
- name: Create Pull Request to push updated devcontainer
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.ACTION_SECRET }}
commit-message: update devcontainer
title: Update devcontainer.json version tag
body: Update devcontainer.json version tag to reflect release changes
branch: update-devcontainer
delete-branch: true
base: main
29 changes: 16 additions & 13 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
branches: [ main ]

permissions:
contents: write # Allow the workflow to push changes to the repository
contents: write
pull-requests: write

jobs:
build:
Expand Down Expand Up @@ -48,25 +49,25 @@ jobs:
"
- name: Upload test durations artifact
if: matrix.python-version == '3.10' && github.repository_owner == github.actor
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v3
with:
name: test-durations-${{ matrix.python-version }}-${{ matrix.split }}
include-hidden-files: true
path: ./tests/test_data/.pytest-split-durations

- name: Upload coverage
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.split }}
include-hidden-files: true
overwrite: false
path: ./.coverage

commit-durations:
if: github.repository_owner == 'autoatml' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
if: github.repository_owner == github.actor
steps:
- uses: actions/checkout@v3

Expand All @@ -79,16 +80,18 @@ jobs:
> tests/test_data/.pytest-split-durations
# Run the Python script to average out test durations
python3 .github/scripts/average_test_durations.py
rm -rf test-durations-*
- name: Commit and push consolidated test durations
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add ./tests/test_data/.pytest-split-durations
git commit -m "Add averaged test durations"
git push origin ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request to push consolidated test durations
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.ACTION_SECRET }}
commit-message: update test durations
title: Update test durations file
body: Auto update test durations file
branch: update-test-durations
delete-branch: true
base: main

coverage:
needs: build
Expand Down
75 changes: 0 additions & 75 deletions .github/workflows/update_devcontainer.yml

This file was deleted.

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

<img src="docs/_static/autoplex_logo.png" width="66%">

**Disclaimer**: `autoplex` is still under very active development and is only suitable for expert users as not all of the documentation is in place. This will change until end of November 2024.
<div style="border: 1px solid #2e3191; padding: 5px; position: relative;">
<div style="background-color: #2e3191; color: #ffffff; padding: 0px; position: absolute; top: 0; left: 0; right: 0; text-align: center;">
<strong>Disclaimer</strong>
</div>
<br>

`autoplex` is still under very active development and is only suitable for expert users as not all of the documentation is in place. This will change until end of November 2024.
</div>

<br>

`autoplex` is a software for generating and benchmarking machine learning (ML)-based interatomic potentials. The aim of `autoplex` is to provide a fully automated solution for creating high-quality ML potentials. The software is interfaced to multiple different ML potential fitting frameworks and to the atomate2 and ase environments for efficient high-throughput computations. The vision of this project is to allow a wide community of researchers to create accurate and reliable ML potentials for materials simulations.

Expand Down Expand Up @@ -32,7 +41,7 @@ All of these software tools provide documentation and tutorials. Please take you

To set up the mandatory prerequisites for using `autoplex,` please follow the [installation guide of atomate2](https://materialsproject.github.io/atomate2/user/install.html).

After setting up `atomate2`, make sure to add `VASP_INCAR_UPDATES: {"NPAR": number}` in your ~/atomate2/config/atomate2.yaml file.
After setting up `atomate2`, make sure to add `VASP_INCAR_UPDATES: {"NPAR": number}` in your `~/atomate2/config/atomate2.yaml` file.
Set a number that is a divisor of the number of tasks you use for the VASP calculations.

# Installation
Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: 75%
threshold: 1%
4 changes: 3 additions & 1 deletion docs/dev/dev_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ However, note that non-python programs like `buildcell` and `julia` needed for A
seperately.

Alternatively, one can use the `devcontainer` provided to have your developer environment setup automatically in your IDE. It has been tested to work in [VSCode](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container) and [PyCharm](https://blog.jetbrains.com/pycharm/2023/06/2023-2-eap-4/).
Only prerequisite is one has [docker](https://docs.docker.com/get-started/get-docker/) installed on the system as it uses the published docker images to create this developer env.
Only prerequisite is one has [docker](https://docs.docker.com/get-started/get-docker/) installed on the system as it uses the published docker images to create this developer env.
One can also simply use [GitHub Codespaces](https://github.com/features/codespaces) to use the devcontainer.
The codespaces environment will have all the required dependencies installed.


## Running unit tests
Expand Down
Loading

0 comments on commit aea4326

Please sign in to comment.