forked from ipburbank/cocotb
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (90 loc) · 2.53 KB
/
build-test-release.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
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
name: Release
on:
# Run this workflow on every push to master or to a stable branch.
push:
branches:
- master
- "stable/**"
tags:
- 'v*'
jobs:
build_release:
name: Build distribution on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Keep going even if one matrix build fails.
matrix:
os:
- ubuntu-22.04
- windows-2022
- macos-12
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install nox
run: python3 -m pip install nox
# Use the cibuildwheel configuration inside nox, instead of the
# cibuildwheel GitHub Action, to make the process easy to reproduce
# locally.
- name: Build cocotb release
run: nox -s release_build
- uses: actions/upload-artifact@v4
with:
name: cocotb-dist-${{ matrix.os }}
path: |
dist/*.whl
dist/*.tar.gz
test_sdist:
name: Test the source distribution (sdist)
needs: build_release
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
path: dist
pattern: cocotb-dist-*
merge-multiple: true
- name: Install nox
run: python3 -m pip install nox
- name: Smoke-test the sdist
run: nox -s release_test_sdist
test_release:
name: Regression Tests
needs: build_release
uses: ./.github/workflows/regression-tests.yml
with:
nox_session_test_sim: release_test_sim
nox_session_test_nosim: release_test_nosim
download_artifacts: true
group: ci
deploy_pypi:
name: Deploy to pypi.org
needs:
- test_release
- test_sdist
runs-on: ubuntu-22.04
# Only upload tagged releases.
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
path: dist
pattern: cocotb-dist-*
merge-multiple: true
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}