Skip to content

Commit ed5446f

Browse files
authored
Merge pull request #32 from eirnym/github-workflows
Basic GitHub actions
2 parents 67229c8 + f28e9bd commit ed5446f

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: CI checks
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
source:
8+
description: Source ref used to build bindings. Uses `github.ref`` by default.
9+
required: false
10+
sha:
11+
description: Source SHA used to build bindings. Uses `github.sha`` by default.
12+
required: false
13+
14+
push:
15+
branches:
16+
- main
17+
paths:
18+
- Cargo.toml
19+
- Cargo.lock
20+
- src/**
21+
- tests/**
22+
- .github/workflows/ci.yaml
23+
pull_request:
24+
paths:
25+
- Cargo.toml
26+
- Cargo.lock
27+
- src/**
28+
- tests/**
29+
- .github/workflows/ci.yaml
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
33+
cancel-in-progress: true
34+
35+
env:
36+
COLOR: yes
37+
FORCE_COLOR: 1
38+
CARGO_TERM_COLOR: always
39+
CARGO_TERM_PROGRESS_WHEN: never
40+
CARGO_INCREMENTAL: 0
41+
RUST_BACKTRACE: 1
42+
CARGO_NET_RETRY: 10
43+
BINSTALL_DISABLE_TELEMETRY: true
44+
45+
permissions: {}
46+
jobs:
47+
ci-build:
48+
name: Build and test
49+
50+
permissions:
51+
contents: read
52+
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Rust version
56+
run: |
57+
rustc --version
58+
cargo --version
59+
60+
- name: Checkout repo
61+
uses: actions/checkout@v6
62+
with:
63+
ref: ${{ github.event.inputs.source || github.ref || github.event.ref }}
64+
65+
- name: Run tests
66+
run: |
67+
cargo test --all

.github/workflows/release.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
name: Release crate
3+
4+
on:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
9+
cancel-in-progress: true
10+
11+
env:
12+
COLOR: yes
13+
FORCE_COLOR: 1
14+
CARGO_TERM_COLOR: always
15+
CARGO_TERM_PROGRESS_WHEN: never
16+
CARGO_INCREMENTAL: 0
17+
RUST_BACKTRACE: 1
18+
CARGO_NET_RETRY: 10
19+
20+
jobs:
21+
build:
22+
permissions:
23+
contents: read
24+
if: ${{ github.ref == 'refs/heads/main' }}
25+
name: Build and test
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Rust version
29+
run: |
30+
rustc --version
31+
cargo --version
32+
33+
- name: Checkout repo
34+
uses: actions/checkout@v6
35+
36+
- name: Run tests
37+
run: |
38+
cargo test --all
39+
40+
- name: Verify publishing
41+
run: cargo publish --dry-run
42+
43+
publish-github:
44+
permissions:
45+
contents: write
46+
runs-on: ubuntu-latest
47+
needs: build
48+
steps:
49+
- name: Checkout repo
50+
uses: actions/checkout@v6
51+
- name: Publish github
52+
run: |
53+
package_version=$(cargo metadata --format-version 1 --no-deps| jq -r '.packages[] | select(.name=="custom_debug") .version')
54+
gh release create "v${package_version}" --fail-on-no-commits --generate-notes --latest
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
publish-cargo:
59+
runs-on: ubuntu-latest
60+
needs: publish-github
61+
permissions:
62+
contents: read
63+
steps:
64+
- name: Checkout repo
65+
uses: actions/checkout@v6
66+
- name: Package
67+
run: cargo publish --no-verify
68+
env:
69+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)