forked from google/sentencepiece
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (90 loc) · 4.04 KB
/
wheel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Build and Publish Wheels
on:
pull_request:
branches: [ main ]
env:
DOMAIN: poolside
REPOSITORY: poolside-dagster
WHEEL_DST: /tmp/sp_wheelhouse
jobs:
build_wheels:
strategy:
matrix:
os: [ubuntu-latest, macOS-14]
runs-on: ${{ matrix.os }}
name: Build wheels on ${{ matrix.os }}
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
# - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::939990436136:role/gh-action-publish-artifacts-role
aws-region: us-east-1
- name: Make sure destination dir exists
run: |
mkdir -p ${{env.WHEEL_DST}}
if [ ! -d ${{env.WHEEL_DST}}]; then
echo "wheel dest dir does not exist!"
exit 1
fi
- name: Install cibuildwheel
working-directory: ${{github.workspace}}/python
run: |
python3 -m pip install --require-hashes --no-dependencies -r ../.github/workflows/requirements/base.txt
python3 -m pip install --require-hashes --no-dependencies -r ../.github/workflows/requirements/cibuildwheel.txt
- name: Build for Mac
if: runner.os == 'macOS'
run: |
cmake -B ${{github.workspace}}/build -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
cmake --build ${{github.workspace}}/build --config Release --target install --parallel 8
env:
CMAKE_OSX_ARCHITECTURES: arm64;x86_64
- name: Build wheels
working-directory: ${{github.workspace}}/python
run: python3 -m cibuildwheel --output-dir ${{env.WHEEL_DST}}
env:
# CIBW_BUILD: cp311-* cp312-*
CIBW_BUILD: cp312-*
CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_ARCHS_MACOS: arm64
CIBW_SKIP: "pp* *-musllinux_*"
CIBW_BUILD_VERBOSITY: 1
# - name: Build sdist archive
# working-directory: ${{github.workspace}}/python
# run: sh build_sdist.sh
# - name: Fetch sdist archive
# uses: tj-actions/glob@2944188f585a0ec102a6a82d9eeb3aed69785393 # v22.0.1
# id: sdist
# with:
# files: ./python/dist/*.tar.gz
# - name: Build wheel from sdist
# run: python3 -m pip wheel "${{ steps.sdist.outputs.paths }}" --wheel-dir=${{env.WHEEL_DST}} --verbose
# - name: Authenticate with AWS CodeArtifact
# run: |
# CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token --domain ${{env.DOMAIN}} --query authorizationToken --output text)
# echo "[distutils]" > ~/.pypirc
# echo "index-servers = codeartifact" >> ~/.pypirc
# echo "[codeartifact]" >> ~/.pypirc
# echo "repository: ${{ env.REPOSITORY }}" >> ~/.pypirc
# echo "username: aws" >> ~/.pypirc
# echo "password: ${CODEARTIFACT_AUTH_TOKEN}" >> ~/.pypirc
- name: Publish
run: |
# export TWINE_USERNAME=aws
# export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain ${{env.DOMAIN}} --query authorizationToken --output text`
# export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain ${{env.DOMAIN}} --repository ${{ env.REPOSITORY }} --region us-east-1 --format pypi --query repositoryEndpoint --output text`
aws codeartifact login --tool twine --domain ${{env.DOMAIN}} --repository ${{ env.REPOSITORY }}
twine upload --verbose --repository codeartifact ${{env.WHEEL_DST}}/*.whl