-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (136 loc) · 5.11 KB
/
publish.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Publish Packages
on:
workflow_dispatch:
inputs:
origen_metal_python_package:
description: Publish the Origen Metal python package
default: "false"
origen_python_package:
description: Publish the Origen python package
default: "false"
# build_for_debug_target:
# description: If 'true', does not use the '--release' switch when building Rust libraries
# required: false
# default: "false"
# publish_pypi:
# description: Publish built packages to PyPi
# required: true
# default: false
publish_pypi_test:
description: Publish To PyPI Test Server
required: true
default: "false"
# publish_github_release:
# description: Publish built packages to Github Release page
# required: true
# default: false
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.SUPPORTED_OS) }}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ fromJSON(vars.RUST_VERSION) }}
rustflags:
- name: Override Project Rust Version
run: rustup override set ${{ fromJSON(vars.RUST_VERSION) }}
- name: Check Rust Version
run: |
rustc --version
cargo --version
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display Python Version
run: python -c "import sys; print(sys.version)"
- name: Install Poetry
run: |
pip install poetry==1.3.2
poetry --version
# Needed to compile keyring library
# Install taken from keyring library:
# https://github.com/hwchen/keyring-rs/blob/v0.10.1/.github/workflows/ci.yaml#L80-L84
- name: install libdbus
run: |
sudo apt update
sudo apt install libdbus-1-dev
if: contains(matrix.os, 'ubuntu')
- name: Build Origen Metal Python Package
working-directory: python/origen_metal
run: poetry build --format wheel
- name: Display Dist Directory
working-directory: python/origen_metal/dist
run: ls
- name: Upload Origen Metal Python Package Artifact
uses: actions/upload-artifact@v2
with:
name: origen-metal-wheels
path: python/origen_metal/dist/origen_metal*
# - name: Build Origen CLI
# working-directory: rust/origen/cli
# run: cargo build --bins --release
# - name: Add Origen to PATH (Linux)
# if: matrix.os == 'ubuntu-latest'
# run: echo "${{ github.workspace }}/rust/origen/target/release" >> $GITHUB_PATH
# - name: Add Origen to PATH (Windows)
# if: matrix.os == 'windows-latest'
# run: echo "${{ github.workspace }}/rust/origen/target/release" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# - name: Display Origen CLI Version
# run: origen -v
# - name: Build PyAPI
# working-directory: rust/pyapi
# run: cargo build --release
# - name: Setup App Env
# working-directory: python
# run: origen env setup
# - name: Display Origen App Version
# working-directory: python
# run: origen -v
- name: Build Origen Python Package
working-directory: python/origen
run: poetry build --format wheel
- name: Display Dist Directory
working-directory: python/origen/dist
run: ls
- name: Upload Origen Python Package Artifact
uses: actions/upload-artifact@v2
with:
name: origen-wheels
path: python/origen/dist/origen*
# - name: "Publish To PyPi"
# if: ${{ github.event.inputs.publish_pypi }} == true
# working_directory: python
# run: |
# echo "Publishing to PyPi"
# # poetry publish ...
- name: "Publish To PyPi Test Server"
if: ${{ github.event.inputs.publish_pypi_test == 'true' }}
working-directory: python
run: |
echo "Publishing to PyPi Test Server"
poetry config repositories.pypi-test https://test.pypi.org/legacy/
poetry config pypi-token.pypi-test ${{ secrets.PYPI_TEST_SERVER_API_TOKEN }}
poetry publish -r pypi-test
# - name: pypi-publish
# if: ${{ github.event.inputs.publish_pypi_test == 'true' }}
# uses: pypa/gh-action-pypi-publish@v1.4.2
# with:
# packages_dir: python/dist/
# user: __token__
# password: ${{ secrets.PYPI_TEST_SERVER_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# skip_existing: true
# - name: "Publish To Github Releases"
# if: ${{ github.event.inputs.publish_github_release }} == true
# working_directory: python
# run: |
# echo "Publishing to Github Releases"
# # ...