Switch to a singleton Shell resetter #143
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pr | |
on: | |
pull_request: {} | |
jobs: | |
tagfile: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # For $ git tag | |
- name: Ensure Tagfile is usable | |
run: grep -E '^[0-9]+[.][0-9]+[.][0-9]+$' Tagfile | |
- name: Checkout master Tagfile | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
path: ./master-Tagfile | |
- name: Ensure Tagfile has changes | |
run: '! diff -q Tagfile ./master-Tagfile/Tagfile' | |
- name: Ensure tag wasn't published already | |
run: git tag | grep -vF $(cat Tagfile) | |
- name: Ensure new tag is a 1-increment | |
run: | | |
curr=$(cat Tagfile) | |
prev=./master-Tagfile/Tagfile | |
{ | |
echo $(( $(cut -d. -f1 <$prev) + 1 )).$(cut -d. -f2 <$prev).$(cut -d. -f3 <$prev) | |
echo $(cut -d. -f1 <$prev).$(( $(cut -d. -f2 <$prev) + 1 )).$(cut -d. -f3 <$prev) | |
echo $(cut -d. -f1 <$prev).$(( $(cut -d. -f2 <$prev) + 1 )).0 | |
echo $(cut -d. -f1 <$prev).$(cut -d. -f2 <$prev).$(( $(cut -d. -f3 <$prev) + 1 )) | |
} | awk '{ printf("%s ", $0) }' | grep -F "$curr" | |
check-goimports: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
go-version: '>=1.17.0' | |
- run: go install github.com/incu6us/goimports-reviser/[email protected] | |
- run: which goimports-reviser | |
- run: find . -type f -iname '*.go' ! -iname '*.pb.go' -exec goimports-reviser -file-path {} \; | |
- run: git --no-pager diff --exit-code | |
check-nillness: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
- run: go run golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest ./... | |
checks: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
check: | |
- goreleaser-dist | |
- ci-check--lint | |
- ci-check--mod | |
- ci-check--test | |
- ci-check--protolock | |
# - ci-check--protolock-force | |
- ci-check--protoc | |
steps: | |
- name: Set lowercase image name | |
run: echo IMAGE=ghcr.io/${SLUG,,} >>$GITHUB_ENV | |
env: | |
SLUG: ${{ github.repository }} | |
- uses: actions/checkout@v3 | |
- uses: docker/[email protected] | |
- name: Log in to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/[email protected] | |
with: | |
files: ./docker-bake.hcl | |
targets: ${{ matrix.check }} | |
# TODO: cache-to | |
# set: | | |
# *.cache-to=type=registry,ref=${{ env.IMAGE }}:${{ matrix.check }},mode=max | |
- run: git --no-pager diff --exit-code | |
# TODO: cache-to | |
# - if: github.ref == 'refs/heads/master' | |
# name: If on master push image to GHCR | |
# run: docker push ${{ env.IMAGE }}:${{ matrix.check }} | |
- if: matrix.check == 'goreleaser-dist' | |
name: Test CLI | |
run: | | |
tar zxvf ./dist/monkey-Linux-x86_64.tar.gz -C . | |
./monkey -h | grep monkey | |
./monkey help | grep monkey | |
./monkey version | |
./monkey fmt | |
[[ $(./monkey version | wc -l) = 1 ]] | |
./monkey version | grep -F $(cat Tagfile) | |
./monkey --version | grep -F $(cat Tagfile) |