Skip to content

Commit c0be830

Browse files
authored
Merge pull request #60 from neutrons/release/v1.5-prod
Release v1.5 to Production
2 parents 16a4f7d + bbfd5d8 commit c0be830

25 files changed

+1872
-411
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/publish.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,16 @@ jobs:
2222

2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v6
2626
with:
2727
fetch-depth: 0
28-
- uses: conda-incubator/setup-miniconda@v3
29-
with:
30-
auto-update-conda: true
31-
channels: conda-forge,defaults
32-
mamba-version: "*"
33-
environment-file: environment.yml
34-
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
35-
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
36-
- name: Install requirements
37-
run: |
38-
# --quiet should turn off progress bars to make logs more readable
39-
conda env create
28+
- name: Setup Pixi
29+
uses: prefix-dev/setup-pixi@v0.9.3
4030

4131
- name: Create tag version
4232
id: tag
4333
run: |
44-
conda activate livedata
45-
echo "tag=$(versioningit)" >> $GITHUB_OUTPUT
34+
echo "tag=$(pixi run versioningit)" >> $GITHUB_OUTPUT
4635
4736
- name: Create latest tag version
4837
id: latest_tag
@@ -87,8 +76,8 @@ jobs:
8776
tags: ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.latest_tag.outputs.latest_tag }}
8877
push: true
8978

90-
- name: Push version tag only for main branch
91-
if: github.ref == 'refs/heads/main'
79+
- name: Push version tag for branches qa and main
80+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/qa'
9281
uses: docker/build-push-action@v6
9382
with:
9483
context: .

.github/workflows/unittest.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ on:
1010
jobs:
1111
linux:
1212
runs-on: ubuntu-latest
13-
defaults:
14-
run:
15-
shell: bash -l {0}
16-
1713
env:
1814
DATABASE_NAME: livedatadb
1915
DATABASE_USER: livedatauser
@@ -27,17 +23,10 @@ jobs:
2723

2824
steps:
2925
- name: Checkout code
30-
uses: actions/checkout@v4
26+
uses: actions/checkout@v6
3127

32-
- name: Setup Conda environment
33-
uses: conda-incubator/setup-miniconda@v3
34-
with:
35-
auto-update-conda: true
36-
channels: conda-forge,defaults
37-
mamba-version: "*"
38-
environment-file: environment.yml
39-
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
40-
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
28+
- name: Setup Pixi
29+
uses: prefix-dev/setup-pixi@v0.9.3
4130

4231
- name: Start docker containers
4332
run: |
@@ -48,7 +37,7 @@ jobs:
4837
run: sleep 30
4938

5039
- name: Run unit tests
51-
run: python -m pytest tests/
40+
run: pixi run test
5241

5342
- name: Stop the coverage process
5443
# Stopping the coverage process allows the code coverage to be written to disk
@@ -58,19 +47,18 @@ jobs:
5847
run: docker cp live_data_server-django-1:/var/www/livedata/app /tmp/
5948

6049
- name: Combine and show code coverage
61-
shell: bash -l {0}
6250
run: |
63-
cd /tmp/app
64-
coverage combine
65-
coverage xml
66-
cp coverage.xml $OLDPWD
67-
coverage report
51+
pixi run coverage combine --data-file=/tmp/app/.coverage
52+
cp /tmp/app/.coverage src
53+
cd src
54+
pixi run coverage xml
55+
pixi run coverage report
6856
6957
- name: Bring down docker containers completely now
7058
# This will completely remove the containers
7159
run: docker compose down
7260

7361
- name: Upload coverage reports to Codecov
74-
uses: codecov/codecov-action@v4
62+
uses: codecov/codecov-action@v5
7563
with:
7664
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update lockfiles
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: 0 5 1 * *
11+
12+
jobs:
13+
pixi-update:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
- name: Set up pixi
18+
uses: prefix-dev/setup-pixi@v0.9.3
19+
with:
20+
run-install: false
21+
- name: Update lockfiles
22+
run: |
23+
set -o pipefail
24+
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
25+
- name: Create pull request
26+
uses: peter-evans/create-pull-request@v8
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
commit-message: Update pixi lockfile
30+
title: Update pixi lockfile
31+
body-path: diff.md
32+
branch: update-pixi
33+
base: next # change this to the default branch of your repository
34+
labels: pixi
35+
delete-branch: true
36+
add-paths: pixi.lock

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,6 @@ target/
6767

6868
# Ruff cache
6969
.ruff_cache
70+
# pixi environments
71+
.pixi/*
72+
!.pixi/config.toml

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-added-large-files
66
args: [--maxkb=8192]
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
- id: trailing-whitespace
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.6.1
14+
rev: v0.14.10
1515
hooks:
1616
- id: ruff
1717
args: [--fix, --exit-non-zero-on-fix]

.readthedocs.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
version: 2
22

33
build:
4-
os: ubuntu-22.04
4+
os: "ubuntu-24.04"
55
tools:
6-
python: "mambaforge-4.10"
6+
python: "3.11"
7+
jobs:
8+
create_environment:
9+
- asdf plugin add pixi
10+
- asdf install pixi latest
11+
- asdf global pixi latest
12+
install:
13+
- pixi install
14+
build:
15+
html:
16+
- pixi run sphinx-build -T -b html docs $READTHEDOCS_OUTPUT/html
717

818
sphinx:
919
builder: html
1020
configuration: docs/conf.py
1121
fail_on_warning: true
12-
13-
conda:
14-
environment: environment.yml

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ Developer documentation at <https://livedata-ornl.readthedocs.io/en/latest/>
1313

1414
### Dependencies
1515

16-
- [Conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) / [Mamba/Miniforge](https://github.com/conda-forge/miniforge)
16+
- [Pixi](https://pixi.sh/latest/installation/)
1717
- [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/)
1818
- [direnv](https://direnv.net/) (optional)
1919

2020
### Setup for Local Development
2121

2222
1. Clone the repository and `cd` into the project directory.
2323

24-
1. Create a conda environment `livedata`, containing all the dependencies
24+
1. Create a pixi environment `live_data_server`, containing all the dependencies
2525

2626
```python
27-
conda env create -f environment.yml
28-
conda activate livedata
27+
pixi install
28+
pixi shell
2929
```
3030

3131
1. To deploy this application locally, you will need to set a number of environment variables,
@@ -69,8 +69,8 @@ Developer documentation at <https://livedata-ornl.readthedocs.io/en/latest/>
6969
After the setup, with the server running, you can test your setup by running `pytest`:
7070

7171
```bash
72-
pytest tests/test_post_get.py
73-
# or simply
72+
pixi run test
73+
# or
7474
pytest
7575
```
7676

@@ -95,7 +95,7 @@ Additional documentation is available in the `docs` directory. To build the docu
9595
run the following command from within directory `docs/`:
9696

9797
```bash
98-
make html
98+
pixi run -e docs make html
9999
```
100100

101101
The documentation will be built in the `docs/_build/html` directory. To view the documentation,

deploy/django/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM continuumio/miniconda3:23.10.0-1 AS base
1+
FROM ghcr.io/prefix-dev/pixi:0.50.2-jammy AS base
22

33
### System dependencies and cron job setup
44
RUN apt-get update -y && \
55
# apt upgrade -y && \
66
apt-get install -y \
7-
vim cron
7+
vim cron wget
88

99
# Set up cron job to purge expired data once a month
1010
COPY scripts/periodic-purge.sh /var/opt/
@@ -16,8 +16,9 @@ RUN echo "0 0 1 * * /var/opt/periodic-purge.sh >> /var/log/cron.log 2>&1" > /etc
1616
### Environment setup
1717
FROM base AS build
1818

19-
COPY environment.yml .
20-
RUN conda env create
19+
COPY pixi.lock .
20+
COPY pyproject.toml .
21+
RUN pixi install --locked -e deploy
2122

2223
WORKDIR /var/www/livedata
2324
COPY src app
@@ -28,4 +29,4 @@ FROM build AS final
2829

2930
COPY deploy/django/docker-entrypoint.sh /usr/bin/
3031
RUN chmod +x /usr/bin/docker-entrypoint.sh
31-
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "livedata", "/usr/bin/docker-entrypoint.sh"]
32+
ENTRYPOINT ["pixi", "run" , "-e", "deploy", "/usr/bin/docker-entrypoint.sh"]

docs/developer/config_for_local_use.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ Prerequisites
88
-------------
99
- `Docker <https://docs.docker.com/get-docker/>`_
1010
- `Docker Compose <https://docs.docker.com/compose/install/>`_
11-
- `Conda <https://docs.conda.io/en/latest/miniconda.html>`_
11+
- `Pixi <https://pixi.sh>`_
1212

1313
Setup
1414
-----
1515

1616
Clone the repository and ``cd`` into the project directory.
1717

18-
Create a conda environment ``livedata``, containing all the dependencies
18+
Create a pixi environment ``live_data_server``, containing all the dependencies
1919

2020
.. code-block:: python
2121
22-
conda env create -f environment.yml
23-
conda activate livedata
22+
pixi install
23+
pixi shell
2424
2525
To deploy this application locally, you will need to set a number of environment variables,
2626
for example (bash):

0 commit comments

Comments
 (0)