Skip to content

Commit e6558f1

Browse files
committed
add CI
1 parent 1904de4 commit e6558f1

3 files changed

Lines changed: 115 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @SwissDataScienceCenter/codev

.github/workflows/release.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
tags:
7+
- "v*"
8+
env:
9+
CRATE_NAME: coman
10+
GITHUB_TOKEN: ${{ github.token }}
11+
RUST_BACKTRACE: 1
12+
jobs:
13+
release:
14+
name: Release - ${{ matrix.platform.os_name }}
15+
strategy:
16+
matrix:
17+
platform:
18+
- os_name: Linux-x86_64
19+
os: ubuntu-latest
20+
target: x86_64-unknown-linux-musl
21+
bin: coman
22+
name: coman-Linux-x86_64-musl.tar.gz
23+
cargo_command: cargo
24+
25+
- os_name: Windows-aarch64
26+
os: windows-latest
27+
target: aarch64-pc-windows-msvc
28+
bin: coman.exe
29+
name: coman-Windows-aarch64.zip
30+
cargo_command: cargo
31+
32+
- os_name: macOS-x86_64
33+
os: macOS-latest
34+
target: x86_64-apple-darwin
35+
bin: coman
36+
name: coman-Darwin-x86_64.tar.gz
37+
cargo_command: cargo
38+
39+
runs-on: ${{ matrix.platform.os }}
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v5
43+
- name: Install toolchain
44+
uses: dtolnay/rust-toolchain@stable
45+
with:
46+
targets: ${{ matrix.platform.target }}
47+
- name: Install musl-tools on Linux
48+
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
49+
if: contains(matrix.platform.os, 'ubuntu')
50+
- name: Build binary (*nix)
51+
shell: bash
52+
run: |
53+
${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }}
54+
if: ${{ !contains(matrix.platform.os, 'windows') }}
55+
- name: Build binary (Windows)
56+
# We have to use the platform's native shell. If we use bash on
57+
# Windows then OpenSSL complains that the Perl it finds doesn't use
58+
# the platform's native paths and refuses to build.
59+
shell: powershell
60+
run: |
61+
& ${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }}
62+
if: contains(matrix.platform.os, 'windows')
63+
- name: Strip binary
64+
shell: bash
65+
run: |
66+
strip target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
67+
if: ${{ !( matrix.platform.target == 'aarch64-pc-windows-msvc') }}
68+
- name: Package as archive
69+
shell: bash
70+
run: |
71+
cd target/${{ matrix.platform.target }}/release
72+
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
73+
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
74+
else
75+
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
76+
fi
77+
cd -
78+
- name: Publish GitHub release
79+
uses: softprops/action-gh-release@v1
80+
with:
81+
draft: true
82+
files: "coman*"
83+
body_path: Changes.md
84+
if: startsWith( github.ref, 'refs/tags/v' )

.github/workflows/test.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Lint and Test
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
permissions: read-all
8+
env:
9+
CRATE_NAME: coman
10+
GITHUB_TOKEN: ${{ github.token }}
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
check-linux:
15+
name: check-linux
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
- name: setup rust and tooling
21+
run: |
22+
rustup update stable
23+
rustup default stable
24+
cargo install oas3-gen
25+
- name: Build
26+
run: cargo build --verbose
27+
- name: Lint
28+
run: cargo clippy --all-targets --all-features -p coman
29+
- name: Test
30+
run: cargo test --verbose

0 commit comments

Comments
 (0)