Skip to content

Commit 112770e

Browse files
authored
Adding in build & release workflows (#4)
Adding in build & release workflows
1 parent e3507a6 commit 112770e

7 files changed

Lines changed: 927 additions & 4 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Pull Request Workflow
2+
3+
on:
4+
pull_request:
5+
6+
7+
# maybe we can share these permissions
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
windows:
14+
uses: ./.github/workflows/pull_request_workflow.yml
15+
with:
16+
platform: windows-2022
17+
18+
#linux:
19+
# uses: ./.github/workflows/pull_request_workflow.yml
20+
# with:
21+
# platform: ubuntu-20.04
22+
23+
#mac:
24+
# uses: ./.github/workflows/pull_request_workflow.yml
25+
# with:
26+
# platform: macos-12
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
platform:
5+
required: true
6+
type: string
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
setup-and-build:
14+
uses: ./.github/workflows/setup-and-build.yml
15+
with:
16+
platform: ${{inputs.platform}}
17+
18+
unit-test:
19+
runs-on: ${{inputs.platform}}
20+
needs: setup-and-build
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Restore Rust Dependencies
26+
uses: actions/cache/restore@v3
27+
with:
28+
path: |
29+
~/.cargo/bin/
30+
~/.cargo/registry/index/
31+
~/.cargo/registry/cache/
32+
~/.cargo/git/db/
33+
target/
34+
key: ${{inputs.platform}}-${{github.sha}}
35+
36+
- name: Run Unit Tests
37+
run: cargo test --no-fail-fast

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
type: string
9+
artifacts:
10+
required: true
11+
type: string
12+
# TODO: eventually we can auto-generate this
13+
tag:
14+
required: true
15+
type: string
16+
name:
17+
required: true
18+
type: string
19+
body:
20+
required: true
21+
type: string
22+
23+
jobs:
24+
setup-and-build:
25+
uses: ./.github/workflows/setup-and-build.yml
26+
with:
27+
platform: ${{inputs.platform}}
28+
29+
release:
30+
runs-on: ${{inputs.platform}}
31+
needs: setup-and-build
32+
permissions:
33+
contents: write
34+
steps:
35+
- name: Restore Rust Dependencies
36+
uses: actions/cache/restore@v3
37+
with:
38+
path: |
39+
~/.cargo/bin/
40+
~/.cargo/registry/index/
41+
~/.cargo/registry/cache/
42+
~/.cargo/git/db/
43+
target/
44+
key: ${{inputs.platform}}-${{github.sha}}
45+
46+
- name: Run Cargo Build
47+
run:
48+
cargo build --release
49+
50+
- name: Publish Release
51+
uses: ncipollo/release-action@v1
52+
with:
53+
artifacts: ${{inputs.artifacts}}
54+
name: ${{inputs.name}}
55+
body: ${{inputs.body}}
56+
tag: ${{inputs.tag}}
57+
# will remove this once the tool is out of the alpha/pre-release stage
58+
prerelease: true
59+
# do we need this? Might want to review what's produced
60+
draft: true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
platform:
5+
required: true
6+
type: string
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
setup-and-build:
14+
runs-on: ${{inputs.platform}}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Setup Rust
20+
uses: ATiltedTree/setup-rust@v1
21+
with:
22+
rust-version: 1.66.0
23+
24+
- name: Build
25+
run:
26+
cargo build
27+
28+
# from https://github.com/actions/cache/blob/main/examples.md#rust---cargo
29+
- name: Cache Rust Dependencies
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
~/.cargo/bin/
34+
~/.cargo/registry/index/
35+
~/.cargo/registry/cache/
36+
~/.cargo/git/db/
37+
target/
38+
key: ${{inputs.platform}}-${{github.sha}}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Windows Release Workflow
2+
3+
on:
4+
workflow_dispatch:
5+
branches:
6+
- main
7+
8+
permissions:
9+
# required for us to upload artifacts from the release
10+
contents: write
11+
pull-requests: read
12+
13+
14+
jobs:
15+
windows-release:
16+
uses: ./.github/workflows/release.yml
17+
with:
18+
# all other inputs will be done by hand
19+
platform: windows-2022
20+
artifacts: "target/release/benchmark.exe,target/release/permutor-cli.exe"

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# will have compiled files and executables
33
target/
44

5-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
6-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
7-
Cargo.lock
8-
95
# These are backup files generated by rustfmt
106
**/*.rs.bk
117

0 commit comments

Comments
 (0)