Skip to content

Commit a378bde

Browse files
committed
Rework Github CI
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
1 parent d11d390 commit a378bde

File tree

6 files changed

+145
-61
lines changed

6 files changed

+145
-61
lines changed

.github/codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
codecov:
2+
notify:
3+
after_n_builds: 6

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
upload-wheel:
7+
type: boolean
8+
required: false
9+
default: false
10+
description: Upload wheel as an artifact
11+
pull_request:
12+
push:
13+
branches: [ main ]
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
tests:
24+
uses: ./.github/workflows/step_test.yaml
25+
secrets:
26+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
27+
28+
build-wheel:
29+
uses: ./.github/workflows/step_build-wheel.yaml
30+
needs: [ tests ]
31+
with:
32+
upload: ${{ inputs.upload-wheel || false }}

.github/workflows/main.yaml

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

.github/workflows/release.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Prepare release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
tests:
14+
uses: ./.github/workflows/step_test.yaml
15+
build-wheel:
16+
needs: [ tests ]
17+
uses: ./.github/workflows/step_build-wheel.yaml
18+
upload_pypi:
19+
name: Upload to PyPI repository
20+
needs: [ tests, build-wheel ]
21+
runs-on: ubuntu-latest
22+
environment:
23+
name: pypi
24+
url: https://pypi.org/project/spglib/
25+
permissions:
26+
id-token: write
27+
steps:
28+
- uses: actions/download-artifact@v3
29+
with:
30+
name: artifact
31+
path: dist
32+
- name: Publish package to PyPI
33+
uses: pypa/gh-action-pypi-publish@release/v1
34+
release:
35+
needs: [ upload_pypi ]
36+
name: Create release
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v3
40+
- uses: softprops/action-gh-release@v1
41+
with:
42+
name: FMF-Jinja ${{ github.ref_name }}
43+
draft: true
44+
prerelease: ${{ contains(github.ref, 'rc') }}
45+
generate_release_notes: true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
upload:
5+
required: false
6+
type: boolean
7+
default: true
8+
description: Upload wheel as artifact
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Build package
19+
run: pipx run build
20+
- uses: actions/upload-artifact@v3
21+
with:
22+
path: dist/*
23+
if: ${{ inputs.upload }}

.github/workflows/step_test.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
workflow_call:
3+
secrets:
4+
CODECOV_TOKEN:
5+
required: false
6+
description: Codecov token
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
pre-commit:
13+
name: Run pre-commit
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-python@v4
18+
- uses: pre-commit/action@v3.0.0
19+
20+
checks:
21+
name:
22+
Check 🐍 ${{ matrix.python-version }}
23+
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ]
28+
steps:
29+
- uses: actions/checkout@v3
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
allow-prereleases: true
34+
35+
- name: Install package
36+
run: pip install -e.[test_cov]
37+
- name: Test package
38+
run: pytest --cov --cov-report=xml
39+
- name: Upload coverage report
40+
uses: codecov/codecov-action@v3
41+
with:
42+
name: python-${{ matrix.python-version }}

0 commit comments

Comments
 (0)