Skip to content

Commit 1817972

Browse files
committed
ci: initial wip release process
1 parent cb48b34 commit 1817972

File tree

5 files changed

+263
-0
lines changed

5 files changed

+263
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Hello World"
2+
description: "Greet someone"
3+
inputs:
4+
who-to-greet: # id of input
5+
description: "Who to greet"
6+
required: true
7+
default: "World"
8+
outputs:
9+
random-number:
10+
description: "Random number"
11+
value: ${{ steps.random-number-generator.outputs.random-number }}
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Set Greeting
16+
run: echo "Hello $INPUT_WHO_TO_GREET."
17+
shell: bash
18+
env:
19+
INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }}
20+
21+
- name: Random Number Generator
22+
id: random-number-generator
23+
run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT
24+
shell: bash
25+
26+
- name: Set GitHub Path
27+
run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
28+
shell: bash
29+
env:
30+
GITHUB_ACTION_PATH: ${{ github.action_path }}
31+
32+
- name: Run goodbye.sh
33+
run: goodbye.sh
34+
shell: bash
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "Bye"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Validate Python Drivers"
2+
description: "Validates a given python driver"
3+
inputs:
4+
driver-path:
5+
description: "Path to driver to check"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
11+
- uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba #v6.3.1
12+
with:
13+
working-directory: ${{ inputs.driver-path }}
14+
enable-cache: true
15+
# We want a per-project cache and assume that each one uses 'uv'.
16+
# Furthermore, the symbolic links in the project causes '**' globs to fail.
17+
cache-dependency-glob: |
18+
python/${{ inputs.driver-path }}/pyproject.toml
19+
python/${{ inputs.driver-path }}/uv.lock
20+
21+
- name: Check formatting
22+
shell: bash
23+
run: uv run --frozen ruff format --check .
24+
working-directory: ${{ inputs.driver-path }}
25+
26+
- name: Linting
27+
shell: bash
28+
run: uv run --frozen ruff check .
29+
working-directory: ${{ inputs.driver-path }}
30+
31+
- name: Check types
32+
shell: bash
33+
run: uv run --frozen mypy .
34+
working-directory: ${{ inputs.driver-path }}

.github/workflows/release.yaml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- beta
8+
- alpha
9+
- "*.x"
10+
- "jg/release-setup"
11+
12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: write
18+
19+
env:
20+
CARGO_TERM_COLOR: always
21+
CARGO_INCREMENTAL: 0
22+
RUST_BACKTRACE: 1
23+
24+
jobs:
25+
get-next-version:
26+
uses: semantic-release-action/next-release-version/.github/workflows/next-release-version.yml@v4
27+
28+
hello-world-job:
29+
runs-on: ubuntu-latest
30+
name: A job to say hello
31+
needs:
32+
- get-next-version
33+
if: needs.get-next-version.outputs.new-release-published == 'true'
34+
steps:
35+
- uses: actions/checkout@v5
36+
- id: hello-world-composite-action
37+
uses: ./.github/actions/hello-world-composite-action
38+
with:
39+
who-to-greet: "Mona the Octocat"
40+
- run: echo random-number "$RANDOM_NUMBER"
41+
shell: bash
42+
env:
43+
RANDOM_NUMBER: ${{ steps.foo.outputs.random-number }}
44+
45+
check-drivers:
46+
runs-on: ubuntu-latest
47+
name: Check included python drivers
48+
needs:
49+
- get-next-version
50+
if: needs.get-next-version.outputs.new-release-published == 'true'
51+
strategy:
52+
matrix:
53+
projects: ["drivers/hypha-accelerate-driver", "drivers/aim-driver"]
54+
steps:
55+
- uses: actions/checkout@v5
56+
- id: validate-python-driver
57+
uses: ./.github/actions/validate-python-driver
58+
with:
59+
driver-path: ${{ matrix.projects }}
60+
61+
# TODO: test, lint, build... ideally reference the validate workflow
62+
63+
# build:
64+
# runs-on: ubuntu-latest
65+
# name: Build
66+
# if: needs.get-next-version.outputs.new-release-published == 'true'
67+
# steps:
68+
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
69+
# - run: cargo build -r
70+
71+
# release:
72+
# runs-on: ubuntu-22.04
73+
# name: Release
74+
# if: needs.get-next-version.outputs.new-release-published == 'true'
75+
# needs:
76+
# # - build
77+
# - get-next-version
78+
79+
# steps:
80+
# - name: Checkout
81+
# uses: actions/checkout@v5
82+
# with:
83+
# # Fetch all history and tags for calculating next semantic version
84+
# fetch-depth: 0
85+
86+
# - name: Install Rust toolchain
87+
# uses: dtolnay/rust-toolchain@master
88+
# id: rust-toolchain
89+
# with:
90+
# toolchain: stable
91+
92+
# - name: Cache cargo
93+
# uses: actions/cache@v4
94+
# id: cache-cargo
95+
# with:
96+
# path: |
97+
# ~/.cargo/bin/
98+
# ~/.cargo/registry/index/
99+
# ~/.cargo/registry/cache/
100+
# ~/.cargo/git/db/
101+
# target/
102+
# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
103+
104+
# - name: Setup Node.js
105+
# uses: actions/setup-node@v6
106+
# with:
107+
# node-version: lts/*
108+
# check-latest: true
109+
# cache: npm
110+
111+
# - name: Cache npm dependencies
112+
# uses: actions/cache@v4
113+
# id: cache-node-modules
114+
# with:
115+
# path: node_modules
116+
# key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
117+
118+
# - name: Install dependencies
119+
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
120+
# run: npm ci --ignore-scripts --loglevel error
121+
122+
# - name: Download release artifacts
123+
# uses: actions/download-artifact@v6
124+
# with:
125+
# path: artifacts
126+
127+
# - name: ls artifacts
128+
# run: ls -R ./artifacts
129+
130+
# - name: Prepare native artifacts
131+
# run: |
132+
# mkdir napi/
133+
# mv artifacts/bindings-aarch64-apple-darwin/semantic-release-cargo.darwin-arm64.node napi/
134+
# mv artifacts/bindings-x86_64-apple-darwin/semantic-release-cargo.darwin-x64.node napi/
135+
# mv artifacts/bindings-x86_64-unknown-linux-gnu/semantic-release-cargo.linux-x64-gnu.node napi/
136+
137+
# - name: ls napi
138+
# run: ls -R ./napi
139+
140+
# - name: Prepare GitHub Release artifacts
141+
# run: |
142+
# mkdir dist/
143+
# mv artifacts/aarch64-apple-darwin dist/
144+
# mv artifacts/aarch64-unknown-linux-gnu dist/
145+
# mv artifacts/aarch64-unknown-linux-musl dist/
146+
# mv artifacts/i686-unknown-linux-gnu dist/
147+
# mv artifacts/i686-unknown-linux-musl dist/
148+
# mv artifacts/x86_64-apple-darwin dist/
149+
# mv artifacts/x86_64-unknown-linux-gnu dist/
150+
# mv artifacts/x86_64-unknown-linux-musl dist/
151+
152+
# - name: Combine checksums
153+
# run: cat dist/**/semantic-release-cargo-*-SHA256SUM.txt | tee dist/SHA256SUMS.txt
154+
155+
# - name: Prepare semantic-release-cargo for local use
156+
# run: |
157+
# cp dist/x86_64-unknown-linux-musl/semantic-release-cargo-x86_64-unknown-linux-musl ./semantic-release-cargo
158+
# chmod +x ./semantic-release-cargo
159+
160+
# - name: Invoke semantic-release
161+
# env:
162+
# # CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
163+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
# run: npx semantic-release

.releaserc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
branches:
2+
- "+([0-9])?(.{+([0-9]),x}).x"
3+
- stable
4+
- name: beta
5+
prerelease: true
6+
- name: alpha
7+
prerelease: true
8+
- name: main
9+
prerelease: alpha
10+
- name: jg/release-setup
11+
prerelease: tmp
12+
plugins:
13+
- "@semantic-release/commit-analyzer"
14+
- "@semantic-release/release-notes-generator"
15+
- - "@semantic-release/github"
16+
# TODO: prep assets for upload
17+
# - assets:
18+
# - path: target/release/hypha-gateway
19+
# label: hypha-gateway
20+
# - path: target/release/hypha-worker
21+
# label: hypha-worker
22+
# - path: target/release/hypha-data
23+
# label: hypha-data
24+
# - path: target/release/hypha-scheduler
25+
# label: hypha-scheduler
26+
# - path: target/release/hypha-certutil
27+
# label: hypha-certutil
28+
# TODO: gen shasums
29+
# - path: dist/SHA256SUMS.txt
30+
# label: SHA256SUMS.txt

0 commit comments

Comments
 (0)