forked from avengineers/hammocking
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (141 loc) · 5.76 KB
/
ci.yml
File metadata and controls
166 lines (141 loc) · 5.76 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
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
162
163
164
165
166
name: CI
on:
push:
branches: [develop]
pull_request:
branches: [develop]
workflow_dispatch:
inputs:
target_branch:
description: "The branch to release from"
required: true
default: "develop"
prerelease_token:
description:
"The prerelease token can be used when multiple users want to create release candidates.
One can define an own unique token to avoid conflicts: rcN.dev, where N is a digit. For example: rc1.dev"
required: false
default: "rc"
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint:
name: Check (Lint) Commit Messages and Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.target_branch || github.head_ref || github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
# Make sure commit messages follow the conventional commits convention:
# https://www.conventionalcommits.org
- uses: wagoid/commitlint-github-action@v5
test-on-windows:
name: Build and Test on Windows
runs-on: windows-latest
needs:
- lint
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.target_branch || github.head_ref || github.ref_name }}
- name: install tools, build and test
env:
# Workaround to force usage of scoop apps installed in USERPROFILE.
USER_PATH_FIRST: 1
run: |
.\build.ps1
shell: powershell
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: |
out/test-report.xml
test-on-linux:
name: Build and Test on Linux
runs-on: ubuntu-22.04
needs:
- lint
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.target_branch || github.head_ref || github.ref_name }}
- name: Install build system
run: sudo apt-get update && sudo apt-get install cmake ninja-build
- name: Install latest release of llvm (includes clang)
run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20 all && sudo ln -s /usr/bin/llvm-nm-20 /usr/bin/llvm-nm && sudo apt list --installed | grep llvm
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install poetry
run: |
python -m pip install --upgrade poetry
- name: Install dependencies
run: |
poetry install
- name: Run test suite
run: |
poetry run python -m pytest --verbose --capture=tee-sys
release:
if: ${{ github.repository == 'avengineers/hammocking' }}
needs:
- lint
- test-on-windows
- test-on-linux
runs-on: ubuntu-latest
environment: release
concurrency: release
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.target_branch || github.head_ref || github.ref_name }}
- name: Determine Release Type
id: determine_release
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "semantic_release_root_options=" >> $GITHUB_ENV
echo "prerelease=true" >> $GITHUB_ENV
echo "publish_release=true" >> $GITHUB_ENV
elif [ "${{ github.ref_name }}" = "develop" ]; then
echo "semantic_release_root_options=" >> $GITHUB_ENV
echo "prerelease=false" >> $GITHUB_ENV
echo "publish_release=true" >> $GITHUB_ENV
else
echo "semantic_release_root_options=--noop" >> $GITHUB_ENV
echo "prerelease=false" >> $GITHUB_ENV
echo "publish_release=false" >> $GITHUB_ENV
fi
- name: Release
uses: python-semantic-release/python-semantic-release@v9.16.1
id: release
with:
root_options: ${{ env.semantic_release_root_options }}
prerelease_token: ${{ github.event.inputs.prerelease_token }}
prerelease: ${{ env.prerelease }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: env.publish_release == 'true'
with:
user: __token__
password: ${{ secrets.pypi_token_github_deploy }}
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: env.publish_release == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}