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
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/**'
|
||||
tags:
|
||||
- '**'
|
||||
workflow_dispatch: ~
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/**'
|
||||
|
||||
jobs:
|
||||
build-core:
|
||||
runs-on: ${{ matrix.os }}
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
python-version: ['3.9', '3.10', '3.11', '3.12']
|
||||
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
toolchain: nightly
|
||||
override: true
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
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
|
||||
run: |
|
||||
rustup default nightly
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m venv venv
|
||||
|
||||
if [[ ${{ matrix.os }} == windows* ]]
|
||||
then
|
||||
echo source venv/Scripts/activate
|
||||
else
|
||||
echo source venv/bin/activate
|
||||
fi > activate_env.sh
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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 --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
|
||||
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:
|
||||
releases:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-core]
|
||||
needs: [linux, windows , macos]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
Loading…
Reference in New Issue
Block a user