Skip to content

Commit

Permalink
add GHA CI (#16)
Browse files Browse the repository at this point in the history
* add CI

* add GHA badge
  • Loading branch information
burrbull committed Jul 27, 2022
1 parent 8fd2f32 commit 90db9a4
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches: [ staging, trying, main ]
pull_request:

name: Continuous integration

jobs:
check:
name: Cargo check
runs-on: ubuntu-latest
strategy:
matrix:
TARGET: [x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc]

steps:
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.TARGET }}

- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.TARGET }}

- uses: actions-rs/cargo@v1
with:
command: check
args: --target ${{ matrix.TARGET }}
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: release
on:
push:
branches:
- main
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: 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@v2
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/form > form-${{ matrix.target }}${{ matrix.suffix }}

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

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

release:
name: release
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
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:
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' }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
artifacts/**/*
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

* Add GHA CI

## [v0.9.0] - 2022-07-26

[Unreleased]: https://github.com/djmcgill/form/compare/v0.9.0...HEAD
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Form
![crates.io badge](https://img.shields.io/crates/v/form.svg)
[![crates.io](https://img.shields.io/crates/d/form.svg)](https://crates.io/crates/form)
[![crates.io](https://img.shields.io/crates/v/form.svg)](https://crates.io/crates/form)
[![CircleCI](https://circleci.com/gh/djmcgill/form/tree/main.svg?style=svg)](https://circleci.com/gh/djmcgill/form/tree/main)
[![CI](https://github.com/djmcgill/form/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/djmcgill/form)

# Form

A library for splitting apart a large file with multiple modules into the idiomatic rust directory structure, intended for use with svd2rust.
Creates a lib.rs as well as a subdirectory structure in the target directory. It does NOT create the cargo project or the cargo manifest file.
Expand Down

0 comments on commit 90db9a4

Please sign in to comment.