Skip to content

Commit

Permalink
Migrate to the just build system and add automated release tooling (#…
Browse files Browse the repository at this point in the history
…429)

* Create justfile with documentation on how to use it
* Add GitHub action to automatically make a release on tag push
  • Loading branch information
carreter authored Dec 19, 2023
1 parent 74ac92b commit e52eeea
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 113 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
go-version: 1.21
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Just
uses: extractions/setup-just@v1
- name: Generate coverage report
run: go test -v -coverprofile=profile.cov ./...
run: just coverage
- name: Parse overall coverage
run: coverage=$(go tool cover -func profile.cov | tail -1 | rev | cut -f 1 | rev) && echo "COVERAGE=$coverage" >> $GITHUB_ENV
- name: Create the Badge
Expand All @@ -28,4 +30,4 @@ jobs:
filename: coverage.json
label: Coverage
message: ${{ env.COVERAGE }}
color: green
color: green
38 changes: 0 additions & 38 deletions .github/workflows/golangci-lint.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/help_wanted_notify.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: notify social media (help wanted)
name: Notify Discord about "help wanted" issues

on:
issues:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/[email protected]
with:
version: latest
22 changes: 22 additions & 0 deletions .github/workflows/nightly_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Nightly Release

on:
schedule:
- cron: '0 8 * * *' # Run at 0800 UTC (0300 EST) every day

jobs:
mwe:
runs-on: ubuntu-latest
steps:

# Clone repository
- uses: actions/checkout@v2

# Update tag and pre-release
# - Update (force-push) tag to the commit that is used in the workflow.
# - Upload artifacts defined by the user.
- uses: pyTooling/Actions/releaser@r0
with:
tag: nightly
token: ${{ secrets.GITHUB_TOKEN }}
files: ./*
2 changes: 1 addition & 1 deletion .github/workflows/push_notify.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: notify social media
name: Notify Discord

on:
release:
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: goreleaser
name: Release

on:
push:
tags:
- v*.*.*
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
goreleaser:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_DEPLOY_SECRET }}
- uses: actions/checkout@v3
- name: Get changelog
run: |
TAG=${{github.ref_name}}
VERSION=${TAG#v}
{
echo "RELEASE_BODY<<EOF"
echo "# [$VERSION] - $(date +%Y-%m-%d)"
echo "$(awk '/## \['$VERSION']/{flag=1; next} /## \[/{flag=0} flag' CHANGELOG.md)"
echo EOF
} >> "$GITHUB_ENV"
- uses: ncipollo/release-action@v1
with:
makeLatest: true
prerelease: true
body: ${{env.RELEASE_BODY}}
2 changes: 1 addition & 1 deletion .github/workflows/take.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
message: Thanks for taking this issue! Let us know if you have any questions!
trigger: .take
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Test

on:
push:
tags:
- v*
branches:
- main
pull_request:
name: Test

jobs:
test:
strategy:
Expand All @@ -20,5 +22,7 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: go test -v ./...
- name: Set up Just
uses: extractions/setup-just@v1
- name: Run tests
run: just test
43 changes: 0 additions & 43 deletions .goreleaser.yml

This file was deleted.

8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]


## [0.30.0] - 2023-12-18
Oops, we weren't keeping a changelog before this tag!

### Fixed
- Fixed bug that produced wrong overhang in linear, non-directional, single cut reactions. #408
- Fixed bug that produced wrong overhang in linear, non-directional, single cut reactions. #408

[0.30.0]: https://github.com/TimothyStiles/poly/releases/tag/v0.30.0
36 changes: 34 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,42 @@ For non-security bug reports please [submit it using this template!](https://git

If you want to suggest a feature it's as easy as filling out this [issue template](https://github.com/bebop/poly/issues/new?assignees=&labels=&template=feature_request.md&title=), but before you do please [check to see if it's already been suggested!](https://github.com/bebop/poly/labels/enhancement)

# How add a recommended VSCode Plugin
## How to add a recommended VSCode Plugin

Poly comes with a set of recommended plugins for VSCode. If you have suggestions that will simplify life for the poly dev community, consider doing a pull-request after modifying `.vscode/extensions.json`.

# Build and Release Pipelines

## `just` Build System
We use [`just`](https://github.com/casey/just) as a task runner. See their README for install
instructions. To see the available recipes, execute `just list` in the root of the repository.

## Normal Releases
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), which
looks like so: `vMAJOR.MINOR.PATCH`. We also keep a changelog in `CHANGELOG.md`. Major
versions indicate breaking changes to the API, minor versions indicate backwards-compatible
additions to the API, and patch versions indicate bugfixes.

### Cutting a Release

> NOTE: Only contributors with write access to the repository can do this.
To cut a release, check out the `main` branch, merge any desired changes,
and then run `just cut-release <version>` (without the `v` before the version number). This
will perform the following actions locally:

1. Lint and test the codebase
2. Bump the version in the changelog and commit it
3. `git tag` the commit as `v<version>`

Afterward, simply run `git push` and `git push <remote> v<version>` to upload the new commit
and tag to the repository, and GitHub Actions will automatically make a release!

## Nightly Releases
`poly` features automatic nightly releases via GitHub Actions, located
[here](https://github.com/bebop/poly/releases/tag/nightly). These will reflect the status
of the `main` branch as of 0800UTC/0300EST.

# In closing

Thanks, for reading and I'm super psyched to see what you'll do with Poly!
Thanks for reading and I'm super psyched to see what you'll do with Poly!
29 changes: 29 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env just --justfile

# List available recipes
default:
@just --list

# Get coverage profile
coverage:
go test -v -coverprofile=provile.cov ./...

# Linting and static checks
lint:
golangci-lint -c .golangci.yml run

# Run tests
test:
go test -v ./...

branch := `git branch --show-current`

# Bump version in changelog and create commit + tag on current branch
cut-release $NEW_VERSION:
just lint
just test
sed -i "s/## \[Unreleased]\s*\n*/## [Unreleased]\n\n## [$NEW_VERSION] $(date +'%Y-%m-%d')/g" CHANGELOG.md
echo "[$NEW_VERSION]: https://github.com/bebop/poly/releases/tag/v$NEW_VERSION" >> CHANGELOG.md
git add CHANGELOG.md
git commit -m "Release version v$NEW_VERSION"
git tag v$NEW_VERSION

0 comments on commit e52eeea

Please sign in to comment.