Skip to content

Commit baf0d5a

Browse files
committed
CI: optimize and fix release workflow
1 parent 2b76e89 commit baf0d5a

File tree

3 files changed

+48
-17
lines changed

3 files changed

+48
-17
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Make release
1+
name: Create release
22

33
on:
44
workflow_dispatch:
@@ -11,13 +11,13 @@ on:
1111
required: true
1212

1313
jobs:
14-
build:
14+
create-release:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout sources
1818
uses: actions/checkout@v2
1919
with:
20-
ref: github.event.inputs.sha
20+
ref: ${{ github.event.inputs.sha }}
2121

2222
- name: Install stable toolchain
2323
uses: actions-rs/toolchain@v1
@@ -26,8 +26,33 @@ jobs:
2626
toolchain: stable
2727
override: true
2828

29+
- uses: Swatinem/rust-cache@v1
30+
2931
- name: Build
3032
uses: actions-rs/cargo@v1
3133
with:
3234
command: build
3335
args: --release
36+
37+
- name: Create release
38+
id: create_release
39+
uses: actions/create-release@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
tag_name: ${{ github.event.inputs.tag }}
44+
release_name: ${{ github.event.inputs.tag }}
45+
body: RSDS release ${{ github.event.inputs.tag }}
46+
commitish: ${{ github.event.inputs.sha }}
47+
draft: false
48+
prerelease: false
49+
50+
- name: Upload scheduler binary
51+
uses: actions/upload-release-asset@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
upload_url: ${{ steps.create_release.outputs.upload_url }}
56+
asset_path: ./target/release/rsds-scheduler
57+
asset_name: rsds-scheduler
58+
asset_content_type: application/exe

.github/workflows/test.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
# for simplicity we are compiling and testing everything on the Ubuntu environment only.
55
# For multi-OS testing see the `cross.yml` workflow.
66

7-
on: [push, pull_request]
7+
on:
8+
push:
9+
branches:
10+
- master
11+
pull_request:
812

913
name: Test
1014

@@ -24,6 +28,8 @@ jobs:
2428
override: true
2529
components: rustfmt, clippy
2630

31+
- uses: Swatinem/rust-cache@v1
32+
2733
- name: Build
2834
uses: actions-rs/cargo@v1
2935
with:
@@ -34,18 +40,6 @@ jobs:
3440
with:
3541
command: test
3642

37-
#- name: Lint
38-
# uses: actions-rs/cargo@v1
39-
# with:
40-
# command: clippy
41-
# args: -- -D warnings
42-
43-
- name: Formatting
44-
uses: actions-rs/cargo@v1
45-
with:
46-
command: fmt
47-
args: --all -- --check
48-
4943
- name: Setup Python
5044
uses: actions/setup-python@v1
5145
with:
@@ -59,3 +53,15 @@ jobs:
5953
6054
- name: Test Python
6155
run: python -m pytest tests
56+
57+
- name: Lint
58+
uses: actions-rs/cargo@v1
59+
with:
60+
command: clippy
61+
args: -- -D warnings
62+
63+
- name: Formatting
64+
uses: actions-rs/cargo@v1
65+
with:
66+
command: fmt
67+
args: --all -- --check

ci/make_release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def send_github_event(workflow_name: str, token: str, inputs=()):
1212
if inputs is None:
1313
inputs = {}
14-
payload = {"ref": "ci", "inputs": inputs}
14+
payload = {"ref": "master", "inputs": inputs}
1515
headers = {"Authorization": f"token {token}",
1616
"Accept": "application/vnd.github.v3+json"}
1717
response = requests.post(

0 commit comments

Comments
 (0)