mirror of
https://github.com/PaiGramTeam/python-genshin-artifact.git
synced 2024-11-21 22:48:08 +00:00
♻️ Refactor action
Compile using PyO3/maturin-action Use dtolnay/rust-toolchain@nightly for Windows and macOS systems
This commit is contained in:
parent
96d53040e1
commit
95e17027f1
139
.github/workflows/build.yml
vendored
139
.github/workflows/build.yml
vendored
@ -6,84 +6,97 @@ on:
|
|||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- '.github/**'
|
|
||||||
tags:
|
tags:
|
||||||
- '**'
|
- '**'
|
||||||
workflow_dispatch: ~
|
workflow_dispatch: ~
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- '.github/**'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-core:
|
linux:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest]
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||||
python-version: ['3.9', '3.10', '3.11', '3.12']
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
- name: Install Rust toolchain
|
uses: actions/setup-python@v4
|
||||||
uses: actions-rs/toolchain@v1
|
with:
|
||||||
with:
|
python-version: ${{ matrix.python-version }}
|
||||||
target: ${{ matrix.target }}
|
- name: Build wheels
|
||||||
toolchain: nightly
|
uses: PyO3/maturin-action@v1
|
||||||
override: true
|
with:
|
||||||
|
rust-toolchain: nightly
|
||||||
|
command: build
|
||||||
|
args: --release --out dist
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Set nightly as default Rust toolchain
|
windows:
|
||||||
run: |
|
runs-on: windows-latest
|
||||||
rustup default nightly
|
strategy:
|
||||||
|
matrix:
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||||
uses: actions/setup-python@v3
|
steps:
|
||||||
with:
|
- uses: actions/checkout@v4
|
||||||
python-version: ${{ matrix.python-version }}
|
with:
|
||||||
|
submodules: true
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --release --out dist
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Create and start virtual environment
|
macos:
|
||||||
shell: bash
|
runs-on: macos-latest
|
||||||
run: |
|
strategy:
|
||||||
python3 -m venv venv
|
matrix:
|
||||||
|
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
|
||||||
if [[ ${{ matrix.os }} == windows* ]]
|
steps:
|
||||||
then
|
- uses: actions/checkout@v4
|
||||||
echo source venv/Scripts/activate
|
with:
|
||||||
else
|
submodules: true
|
||||||
echo source venv/bin/activate
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
fi > activate_env.sh
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --release --out dist --sdist
|
||||||
|
- name: Build wheels - universal2
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --release --out dist
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Install dependencies
|
releases:
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
source activate_env.sh
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install maturin
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
source activate_env.sh
|
|
||||||
maturin develop
|
|
||||||
|
|
||||||
- name: Export install file
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
source activate_env.sh
|
|
||||||
maturin build --out ./dist
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: python-genshin-artifact
|
|
||||||
path: ./dist
|
|
||||||
|
|
||||||
upload-core:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-core]
|
needs: [linux, windows , macos]
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
Loading…
Reference in New Issue
Block a user