Skip to content

Commit 8c77c4d

Browse files
authored
Add pixi-based workflows (#4)
* Add workflows * pixi workflow : actually run 'main', add import test * pixi : add build dependencies
1 parent 62fe081 commit 8c77c4d

File tree

7 files changed

+1407
-14
lines changed

7 files changed

+1407
-14
lines changed

.gersemirc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
definitions: [./CMakeLists.txt, ./cmake]
1+
definitions: [./CMakeLists.txt, ./cpp-extension, ./cmake]
22
line_length: 80
33
indent: 2
44
warn_about_unknown_commands: false
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build on OSX/Linux via Pixi
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 0 8 3 * *
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- 'doc/**'
12+
- '.gitignore'
13+
- '**.md'
14+
pull_request:
15+
paths-ignore:
16+
- 'doc/'
17+
- '.gitignore'
18+
- '**.md'
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
aligator-example-pixi:
25+
name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }}
26+
runs-on: ${{ matrix.os }}
27+
env:
28+
CCACHE_BASEDIR: "${GITHUB_WORKSPACE}"
29+
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
30+
CCACHE_COMPRESS: true
31+
CCACHE_COMPRESSLEVEL: 6
32+
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: [ubuntu-latest, macos-latest, macos-13]
37+
environment: [default]
38+
build_type: [Release, Debug]
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
submodules: recursive
44+
45+
- uses: actions/cache@v4
46+
with:
47+
path: .ccache
48+
key: ccache-macos-linux-pixi-${{ matrix.os }}-${{ matrix.build_type }}-${{ github.sha }}
49+
restore-keys: ccache-macos-linux-pixi-${{ matrix.os }}-${{ matrix.build_type }}-
50+
51+
- uses: prefix-dev/[email protected]
52+
with:
53+
cache: true
54+
environments: ${{ matrix.environment }}
55+
56+
- name: Build and test aligator-cmake-example-project
57+
shell: bash -l {0}
58+
env:
59+
CMAKE_BUILD_PARALLEL_LEVEL: 4
60+
ALCEP_BUILD_TYPE: ${{ matrix.build_type }}
61+
run: |
62+
pixi run -e ${{ matrix.environment }} test
63+
cd build && ./bin/main
64+
65+
check:
66+
name: check-macos-linux-pixi
67+
68+
needs:
69+
- aligator-example-pixi
70+
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- name: Decide whether the needed jobs succeeded or failed
75+
uses: re-actors/alls-green@release/v1
76+
with:
77+
jobs: ${{ toJSON(needs) }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI - Update Pixi lockfile
2+
permissions:
3+
contents: write
4+
pull-requests: write
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: 0 5 1 * *
10+
11+
jobs:
12+
pixi-update:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/create-github-app-token@v1
17+
id: generate-token
18+
with:
19+
app-id: ${{ secrets.APP_ID }}
20+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
21+
22+
- uses: actions/checkout@v4
23+
with:
24+
token: ${{ steps.generate-token.outputs.token }}
25+
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
26+
persist-credentials: false
27+
28+
- name: Set up pixi
29+
uses: prefix-dev/[email protected]
30+
with:
31+
run-install: false
32+
33+
- name: Update lockfile
34+
run: |
35+
set -o pipefail
36+
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
37+
38+
- name: Create pull request
39+
uses: peter-evans/create-pull-request@v7
40+
with:
41+
token: ${{ steps.generate-token.outputs.token }}
42+
commit-message: 'pixi: Update pixi lockfile'
43+
title: Update pixi lockfile
44+
body-path: diff.md
45+
branch: topic/update-pixi
46+
base: main
47+
labels: pixi
48+
delete-branch: true
49+
add-paths: pixi.lock

.pre-commit-config.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,11 @@ repos:
1717
- id: check-added-large-files
1818
- id: check-case-conflict
1919
- id: check-yaml
20-
exclude: ^packaging/conda/
2120
- id: detect-private-key
2221
- id: end-of-file-fixer
2322
- id: mixed-line-ending
2423
- id: check-merge-conflict
2524
- id: trailing-whitespace
26-
exclude: |
27-
(?x)^(
28-
doc/doxygen-awesome.*
29-
)$
30-
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
# Ruff version.
32-
rev: 'v0.11.7'
33-
hooks:
34-
- id: ruff
35-
args: [--fix, --exit-non-zero-on-fix]
36-
- id: ruff-format
3725
- repo: https://github.com/BlankSpruce/gersemi
3826
rev: 0.19.2
3927
hooks:

cpp-extension/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
function(add_import_test name)
2+
set(test_target ${name})
3+
4+
add_test(
5+
NAME ${name}
6+
COMMAND ${PYTHON_EXECUTABLE} -c "import ${name}"
7+
WORKING_DIRECTORY $<TARGET_FILE_DIR:${name}>
8+
)
9+
endfunction()
10+
111
aligator_create_python_extension(example_extension WITH_SOABI module.cpp)
12+
add_import_test(example_extension)

0 commit comments

Comments
 (0)