-
Notifications
You must be signed in to change notification settings - Fork 8
142 lines (123 loc) · 4.82 KB
/
build.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
name: Build binaries for all platforms
on:
push:
tags:
- "v*"
branches:
- main
workflow_dispatch:
pull_request:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { name: "Linux-x86_64", target: x86_64-linux, os: ubuntu-20.04 }
- { name: "macOS-x86_64", target: x86_64-darwin, os: macOS-13 }
- { name: "macOS-aarch64", target: aarch64-darwin, os: macOS-14 }
# - {
# name: "windows-x86_64",
# target: x86_64-windows,
# os: windows-latest,
# }
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Check for release
id: is-release
shell: bash
run: |
unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install packaged
run: |
pip install .
- name: Build binary
id: build
shell: bash
run: |
# aliens: requires no source
ALIENS_NAME="aliens-${{ matrix.target }}.tar.gz"
ALIENS_PATH=${PWD}/${ALIENS_NAME}
packaged ./aliens.sh 'pip install pygame' 'python -m pygame.examples.aliens'
tar czf $ALIENS_NAME ./aliens.sh
# textual: requires no source
TEXTUAL_NAME="textual-${{ matrix.target }}.tar.gz"
TEXTUAL_PATH=${PWD}/${TEXTUAL_NAME}
packaged ./textual.sh 'pip install textual' 'python -m textual'
tar czf $TEXTUAL_NAME ./textual.sh
# IPython: requires no source
IPYTHON_NAME="ipython-${{ matrix.target }}.tar.gz"
IPYTHON_PATH=${PWD}/${IPYTHON_NAME}
packaged ./ipython.sh 'pip install ipython' 'ipython'
tar czf $IPYTHON_NAME ./ipython.sh
# ./examples/mandelbrot
MANDELBROT_NAME="mandelbrot-${{ matrix.target }}.tar.gz"
MANDELBROT_PATH=${PWD}/${MANDELBROT_NAME}
packaged ./mandelbrot.sh 'pip install -r requirements.txt' 'python mandelbrot.py' ./example/mandelbrot
tar czf $MANDELBROT_NAME ./mandelbrot.sh
# ./examples/minesweeper
MINESWEEPER_NAME="minesweeper-${{ matrix.target }}.tar.gz"
MINESWEEPER_PATH=${PWD}/${MINESWEEPER_NAME}
packaged ./example/minesweeper
tar czf $MINESWEEPER_NAME ./minesweeper.sh
# Setup output paths for upload
echo "ALIENS_NAME=${ALIENS_NAME}" >> $GITHUB_OUTPUT
echo "ALIENS_PATH=${ALIENS_PATH}" >> $GITHUB_OUTPUT
echo "TEXTUAL_NAME=${TEXTUAL_NAME}" >> $GITHUB_OUTPUT
echo "TEXTUAL_PATH=${TEXTUAL_PATH}" >> $GITHUB_OUTPUT
echo "IPYTHON_NAME=${IPYTHON_NAME}" >> $GITHUB_OUTPUT
echo "IPYTHON_PATH=${IPYTHON_PATH}" >> $GITHUB_OUTPUT
echo "MANDELBROT_NAME=${MANDELBROT_NAME}" >> $GITHUB_OUTPUT
echo "MANDELBROT_PATH=${MANDELBROT_PATH}" >> $GITHUB_OUTPUT
echo "MINESWEEPER_NAME=${MINESWEEPER_NAME}" >> $GITHUB_OUTPUT
echo "MINESWEEPER_PATH=${MINESWEEPER_PATH}" >> $GITHUB_OUTPUT
- name: Upload aliens
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.ALIENS_NAME }}
path: ${{ steps.build.outputs.ALIENS_PATH }}
- name: Upload textual
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.TEXTUAL_NAME }}
path: ${{ steps.build.outputs.TEXTUAL_PATH }}
- name: Upload IPython
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.IPYTHON_NAME }}
path: ${{ steps.build.outputs.IPYTHON_PATH }}
- name: Upload mandelbrot
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.MANDELBROT_NAME }}
path: ${{ steps.build.outputs.MANDELBROT_PATH }}
- name: Upload minesweeper
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.MINESWEEPER_NAME }}
path: ${{ steps.build.outputs.MINESWEEPER_PATH }}
- name: Publish packages
uses: softprops/action-gh-release@v1
if: steps.is-release.outputs.IS_RELEASE
with:
draft: true
files: |
${{ steps.build.outputs.ALIENS_PATH }}
${{ steps.build.outputs.TEXTUAL_PATH }}
${{ steps.build.outputs.IPYTHON_PATH }}
${{ steps.build.outputs.MANDELBROT_PATH }}
${{ steps.build.outputs.MINESWEEPER_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}