-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (92 loc) · 4.05 KB
/
build-python.yml
File metadata and controls
106 lines (92 loc) · 4.05 KB
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
# This is a basic workflow to help you get started with Actions
name: build-python
# Controls when the workflow will run
on:
# this is a called workflow
workflow_call:
inputs:
teensy-loader-linux-artifact:
description: "The teensy loader cli executable for linux artifact name"
required: true
type: string
teensy-loader-macos-artifact:
description: "The teensy loader cli executable for mac artifact name"
required: true
type: string
teensy-loader-windows-artifact:
description: "The teensy loader cli executable for windows artifact name"
required: true
type: string
outputs:
build-file:
description: "The output of this build procsss"
value: ${{ jobs.python-build-job.outputs.install-file }}
build-package:
description: "The output of this build procsss"
value: ${{ jobs.python-build-job.outputs.install-package }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Build the installer on mac
python-build-job:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Output
outputs:
install-file: ${{ steps.output-installer.outputs.filename }}
install-package: ${{ steps.output-installer.outputs.packagename }}
# Steps represent a sequence of tasks that will be executed as part of the job
# TODO: Need to make this dependent on the mac, linux, and windows build
# then need to copy all of the executables here. The python packaging will then have to intelligently select the
# correct executable to use based on the OS
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
# Setup python
- name: System Setup
run: |
pip3 install setuptools
# Download the teensy loader cli executable for linux
- name: Download Teensy Loader Linux
uses: actions/download-artifact@v4
with:
name: ${{ inputs.teensy-loader-linux-artifact }}
# Download the teensy loader cli executable for mac
- name: Download Teensy Loader Mac
uses: actions/download-artifact@v4
with:
name: ${{ inputs.teensy-loader-macos-artifact }}
# Download the teensy loader cli executable for windows
- name: Download Teensy Loader Windows
uses: actions/download-artifact@v4
with:
name: ${{ inputs.teensy-loader-windows-artifact }}
# Copy the teensy loader cli executable from the other builds
# Note: A hack here, since setup.py is run now and also when the user installs the package,
# we make linux the default (because this workflow is run on linux). The setup.py script will
# rename the executable to teensy_loader_cli.exe for the other OSes at install time.
- name: Copy Teensy Loader CLI
run: |
echo "Copying Teensy Loader CLIs Within Python Build"
ls $GITHUB_WORKSPACE
cp $GITHUB_WORKSPACE/teensy_loader_cli_linux $GITHUB_WORKSPACE/MicroPython_Firmware_Uploader/resource/teensy_loader_cli.exe
cp $GITHUB_WORKSPACE/teensy_loader_cli_macos $GITHUB_WORKSPACE/MicroPython_Firmware_Uploader/resource/teensy_loader_cli_macos.exe
cp $GITHUB_WORKSPACE/teensy_loader_cli_windows $GITHUB_WORKSPACE/MicroPython_Firmware_Uploader/resource/teensy_loader_cli_windows.exe
# Build the installer
- name: Build Python Installer
run: |
python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: python-install-package
path: dist
- name: Extract package name
run: |
cd dist
echo "PACKAGE_NAME=$(ls *.tar.gz)" >> $GITHUB_ENV
- id: output-installer
run: |
echo "filename=python-install-package" >> $GITHUB_OUTPUT
echo "packagename=${{ env.PACKAGE_NAME }}" >> $GITHUB_OUTPUT