Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edition 2021 #74

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
use flake
PATH=~/.pixi/bin:$PATH

watch_file pixi.lock
eval "$(pixi shell-hook)"
27 changes: 0 additions & 27 deletions .github/workflows/build_nix.yml

This file was deleted.

99 changes: 28 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
os: ubuntu-latest
rust: stable
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -65,65 +65,30 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
with:
toolchain: stable
override: true

- name: Get Rust Version
id: rust-version
run: echo "::set-output name=version::$(cargo -V | head -n1 | awk '{print $2}')"
fetch-depth: 0

- uses: actions/cache@v2
- uses: prefix-dev/setup-pixi@v0.8.1
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ steps.rust-version.outputs.version }}

- name: Install cargo-c (linux)
if: startsWith(matrix.os, 'ubuntu')
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_VERSION: 0.8.0
run: |
curl -L "$LINK/v$CARGO_C_VERSION/cargo-c-linux.tar.gz" |
tar xz -C $HOME/.cargo/bin

- name: Install cargo-c (macos)
if: startsWith(matrix.os, 'macos')
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_VERSION: 0.8.0
run: |
curl -LO "$LINK/v$CARGO_C_VERSION/cargo-c-macos.zip"
7z e -y "cargo-c-macos.zip" -o$HOME/.cargo/bin

- name: Install cargo-c (win)
if: startsWith(matrix.os, 'windows')
run: |
$LINK = "https://github.com/lu-zero/cargo-c/releases/download/v0.8.0"
$CARGO_C_FILE = "cargo-c-windows-msvc"
curl -LO "$LINK/$CARGO_C_FILE.zip"
7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin"
pixi-version: v0.34.0
cache: true
frozen: true

- name: Build C API
run: |
cargo cbuild --verbose --release
pixi run cargo cbuild --verbose --release

- name: Run C API tests
run: |
cargo capi test --verbose --release
pixi run cargo capi test --verbose --release

- name: Install into temporary location
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
run: |
cargo cinstall --verbose --release --destdir=temp
pixi run cargo cinstall --verbose --release --destdir=temp

- name: Copy installed files to /usr/local
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
Expand All @@ -146,7 +111,7 @@ jobs:
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
working-directory: examples/usage-from-c
run: |
make
pixi run make

cross_testing:
runs-on: ubuntu-latest
Expand All @@ -159,13 +124,12 @@ jobs:
s390x-unknown-linux-gnu,
]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
targets: ${{ matrix.target }}

- name: Run tests
uses: actions-rs/cargo@v1
Expand All @@ -177,7 +141,7 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -216,7 +180,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down Expand Up @@ -244,7 +208,7 @@ jobs:
name: "Check if cbindgen runs cleanly for generating the C headers"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -262,37 +226,30 @@ jobs:
minimum_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: check if README matches MSRV defined here
run: grep '1.68.0' README.md

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.68.0
override: true

- name: Check if it builds
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build

publish:
name: Publish (dry-run)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
- uses: prefix-dev/setup-pixi@v0.8.1
with:
profile: minimal
toolchain: stable
override: true
pixi-version: v0.34.0
cache: true
frozen: true

- name: Make sure we can publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run
run: pixi run cargo publish --dry-run
23 changes: 0 additions & 23 deletions .github/workflows/draft-pdf.yml

This file was deleted.

81 changes: 12 additions & 69 deletions .github/workflows/gsw-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,89 +11,32 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: "TEOS-10/GSW-Python"
ref: f9b3f6e4895e9eba37e0bb509291c2046c71c5ee
fetch-depth: 0

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: 'src/GSW-rs'
fetch-depth: 0

- uses: actions-rs/toolchain@v1
- uses: prefix-dev/setup-pixi@v0.8.1
with:
toolchain: stable
override: true

- name: Get Rust Version
id: rust-version
run: echo "::set-output name=version::$(cargo -V | head -n1 | awk '{print $2}')"

- uses: actions/cache@v2
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ steps.rust-version.outputs.version }}

- name: Install cargo-c (linux)
if: startsWith(matrix.os, 'ubuntu')
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_VERSION: 0.8.0
run: |
curl -L "$LINK/v$CARGO_C_VERSION/cargo-c-linux.tar.gz" |
tar xz -C $HOME/.cargo/bin

- name: Install cargo-c (macos)
if: startsWith(matrix.os, 'macos')
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_VERSION: 0.8.0
run: |
curl -LO "$LINK/v$CARGO_C_VERSION/cargo-c-macos.zip"
7z e -y "cargo-c-macos.zip" -o$HOME/.cargo/bin

- name: Install cargo-c (win)
if: startsWith(matrix.os, 'windows')
run: |
$LINK = "https://github.com/lu-zero/cargo-c/releases/download/v0.8.0"
$CARGO_C_FILE = "cargo-c-windows-msvc"
curl -LO "$LINK/$CARGO_C_FILE.zip"
7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin"

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest xarray dask
pixi-version: v0.34.0
cache: true
frozen: true
manifest-path: src/GSW-rs/pixi.toml

- name: Install patched GSW-Python
run: |
git apply src/GSW-rs/utils/gsw-py-patch
pip install .
pixi run --manifest-path src/GSW-rs/pixi.toml python -m pip install .

- name: Run pytest
continue-on-error: true
run: |
pytest -s -rxs -v gsw/tests
pixi run --manifest-path src/GSW-rs/pixi.toml pytest -s -rxs -v gsw/tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
Cargo.lock
convert_refdata/data/gsw_*_validation.bin
.pixi/
Loading
Loading