Skip to content

Commit

Permalink
ci: added a workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
insomnimus committed Jan 9, 2022
1 parent 0128045 commit 3626cdd
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/chglog/RELEASE.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ range .Versions }}
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})

{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
41 changes: 41 additions & 0 deletions .github/chglog/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
style: github
template: RELEASE.tpl.md
info:
repository_url: https://github.com/insomnimus/https://github.com/insomnimus/mtag
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
sort_by: Custom
title_order:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
ci: Continuous Integration
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
212 changes: 212 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
{
"name": "main",
"on": [
"push",
"pull_request"
],
"jobs": {
"test": {
"strategy": {
"matrix": {
"include": [
{
"os": "ubuntu-latest",
"target": "x86_64-unknown-linux-gnu"
},
{
"os": "macOS-11",
"target": "x86_64-apple-darwin"
},
{
"os": "windows-latest",
"target": "x86_64-pc-windows-msvc"
}
]
}
},
"runs-on": "${{ matrix.os }}",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/checkout@v2"
},
{
"name": "Setup | Rust",
"uses": "actions-rs/toolchain@v1",
"with": {
"toolchain": "stable",
"override": true,
"profile": "minimal",
"target": "${{ matrix.target }}"
}
},
{
"name": "Check | Tests",
"uses": "actions-rs/cargo@v1",
"with": {
"command": "test",
"args": "--target ${{ matrix.target }}"
}
}
]
},
"build": {
"name": "Build Release Binaries",
"needs": "test",
"if": "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')",
"continue-on-error": true,
"strategy": {
"fail-fast": false,
"matrix": {
"include": [
{
"target": "x86_64-unknown-linux-gnu",
"name": "mtag-x86_64-linux-gnu.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "x86_64-apple-darwin",
"name": "mtag-x86_64-osx.tar.gz",
"os": "macOS-11"
},
{
"target": "x86_64-pc-windows-msvc",
"name": "mtag-x86_64-windows.zip",
"os": "windows-latest"
},
{
"target": "i686-pc-windows-msvc",
"name": "mtag-i686-windows.zip",
"os": "windows-latest"
},
{
"target": "aarch64-unknown-linux-gnu",
"name": "mtag-aarch64-linux-gnu.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "aarch64-apple-darwin",
"name": "mtag-aarch64-osx.tar.gz",
"os": "macos-11"
},
{
"target": "x86_64-unknown-linux-musl",
"name": "mtag-x86_64-linux-musl.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "i686-unknown-linux-musl",
"name": "mtag-i686-linux-musl.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "aarch64-pc-windows-msvc",
"name": "mtag-aarch64-windows.zip",
"os": "windows-latest"
},
{
"target": "x86_64-unknown-freebsd",
"name": "mtag-x86_64-freeBSD.tar.gz",
"os": "ubuntu-latest"
},
{
"target": "armv7-unknown-linux-gnueabihf",
"name": "mtag-armv7-linux-gnu.tar.gz",
"os": "ubuntu-latest"
}
]
}
},
"runs-on": "${{ matrix.os }}",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/checkout@v2"
},
{
"name": "Setup | Cache Cargo",
"uses": "actions/[email protected]",
"with": {
"path": "~/.cargo/registry\n~/.cargo/git\n",
"key": "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
}
},
{
"name": "Setup | Rust",
"uses": "actions-rs/toolchain@v1",
"with": {
"toolchain": "stable",
"override": true,
"profile": "minimal",
"target": "${{ matrix.target }}"
}
},
{
"name": "Build | Build",
"uses": "actions-rs/cargo@v1",
"with": {
"command": "build",
"args": "--release --target ${{ matrix.target }}",
"use-cross": "${{ matrix.os == 'ubuntu-latest' && matrix.target != 'x86_64-unknown-linux-gnu' }}"
}
},
{
"name": "PostBuild | Prepare",
"if": "matrix.os != 'windows-latest'",
"run": "cd target/${{ matrix.target }}/release\nstrip mtag || true\ntar czvf ../../../${{ matrix.name }} mtag\ncd -"
},
{
"if": "matrix.os == 'windows-latest'",
"name": "PostBuild | Prepare",
"run": "cd target/${{ matrix.target }}/release\n7z a ../../../${{ matrix.name }} mtag.exe\ncd -"
},
{
"name": "Deploy | Upload Artifacts",
"uses": "actions/upload-artifact@v2",
"with": {
"name": "${{ matrix.name }}",
"path": "${{ matrix.name }}"
}
}
]
},
"release": {
"name": "Create GitHub Release",
"needs": "build",
"if": "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')",
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Setup | Checkout",
"uses": "actions/[email protected]",
"with": {
"fetch-depth": 0
}
},
{
"name": "Setup | go",
"uses": "actions/setup-go@v2",
"with": {
"go-version": "^1.15.7"
}
},
{
"name": "Setup | Artifacts",
"uses": "actions/download-artifact@v2"
},
{
"name": "Setup | Release notes",
"run": "GO111MODULE=on go install github.com/git-chglog/git-chglog/cmd/[email protected]\ngit-chglog -c .github/chglog/release.yml $(git describe --tags) > RELEASE.md\n"
},
{
"name": "Deploy | Publish",
"uses": "softprops/action-gh-release@v1",
"with": {
"files": "mtag-*/mtag-*",
"body_path": "RELEASE.md"
}
}
]
}
}
}
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3626cdd

Please sign in to comment.