Skip to content

Commit

Permalink
CI: optimize and fix release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Dec 4, 2020
1 parent 2b76e89 commit baf0d5a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 17 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Make release
name: Create release

on:
workflow_dispatch:
Expand All @@ -11,13 +11,13 @@ on:
required: true

jobs:
build:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
ref: github.event.inputs.sha
ref: ${{ github.event.inputs.sha }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -26,8 +26,33 @@ jobs:
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v1

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
body: RSDS release ${{ github.event.inputs.tag }}
commitish: ${{ github.event.inputs.sha }}
draft: false
prerelease: false

- name: Upload scheduler binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/release/rsds-scheduler
asset_name: rsds-scheduler
asset_content_type: application/exe
32 changes: 19 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
# for simplicity we are compiling and testing everything on the Ubuntu environment only.
# For multi-OS testing see the `cross.yml` workflow.

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

name: Test

Expand All @@ -24,6 +28,8 @@ jobs:
override: true
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v1

- name: Build
uses: actions-rs/cargo@v1
with:
Expand All @@ -34,18 +40,6 @@ jobs:
with:
command: test

#- name: Lint
# uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: -- -D warnings

- name: Formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Setup Python
uses: actions/setup-python@v1
with:
Expand All @@ -59,3 +53,15 @@ jobs:
- name: Test Python
run: python -m pytest tests

- name: Lint
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

- name: Formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
2 changes: 1 addition & 1 deletion ci/make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def send_github_event(workflow_name: str, token: str, inputs=()):
if inputs is None:
inputs = {}
payload = {"ref": "ci", "inputs": inputs}
payload = {"ref": "master", "inputs": inputs}
headers = {"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json"}
response = requests.post(
Expand Down

0 comments on commit baf0d5a

Please sign in to comment.