Skip to content

Commit

Permalink
release action
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed May 15, 2022
1 parent 5c169cd commit 237aeec
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

env:
SVDTOOLS: svd

on:
push:
branches: [ staging, trying, master ]
Expand All @@ -11,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -40,7 +43,7 @@ jobs:
- rp2040
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: release
on:
push:
branches:
- master
tags:
- v*.*.*
workflow_dispatch:

jobs:
build:
strategy:
matrix:
include:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, suffix: .gz }
- { target: x86_64-apple-darwin, os: macos-latest, suffix: .gz }
- { target: aarch64-apple-darwin, os: macos-latest, suffix: .gz }
- { target: x86_64-pc-windows-msvc, os: windows-latest, suffix: .zip }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release

- name: (Not Windows) Move executables and compress
if: ${{ matrix.os != 'windows-latest' }}
run: gzip -c target/${{ matrix.target }}/release/svdtools > svdtools-${{ matrix.target }}${{ matrix.suffix }}

- name: (Windows) Move executables and compress
if: ${{ matrix.os == 'windows-latest' }}
run: Compress-Archive -Path target\${{ matrix.target }}\release\svdtools.exe -DestinationPath svdtools-${{ matrix.target }}${{ matrix.suffix }}

- uses: actions/upload-artifact@v3
with:
name: svdtools-${{ matrix.target }}
path: svdtools-${{ matrix.target }}${{ matrix.suffix }}

release:
name: release
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- run: ls -R ./artifacts

- name: Set current date as environment variable
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- id: changelog-reader
uses: mindsers/[email protected]
with:
path: ./CHANGELOG-rust.md
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}

- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog-reader.outputs.version }}
name: ${{ (github.ref_type == 'tag' && steps.changelog-reader.outputs.version) || format('Prereleased {0}', env.CURRENT_DATE) }}
body: ${{ steps.changelog-reader.outputs.changes }}
prerelease: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
files: |
artifacts/**/*
17 changes: 10 additions & 7 deletions .github/workflows/rust-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Rust CI

env:
SVDTOOLS: svdtools

on:
push:
branches: [ staging, trying, master ]
Expand All @@ -13,7 +16,7 @@ jobs:
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -26,7 +29,7 @@ jobs:
RUSTFLAGS: "-D warnings"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -38,7 +41,7 @@ jobs:
RUSTFLAGS: "-D warnings"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -52,7 +55,7 @@ jobs:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -65,7 +68,7 @@ jobs:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -80,7 +83,7 @@ jobs:
- stm32
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand All @@ -92,4 +95,4 @@ jobs:
run: |
cargo install svdtools --path .
- name: Check
run: env SVDTOOLS=svdtools bash tools/check_${{ matrix.target }}.sh
run: bash tools/check_${{ matrix.target }}.sh
1 change: 1 addition & 0 deletions CHANGELOG-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This changelog tracks the Rust `svdtools` project. See

## [Unreleased]

* Added action to build binaries and release for every version tag and latest commit
* Use `svd-parser` 0.13.4, add `expand_properties` option in `convert`
* `patch`: check enum `usage`, don't add it if unneeded

Expand Down

0 comments on commit 237aeec

Please sign in to comment.