Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
realjenius committed Sep 11, 2023
1 parent d69e4e9 commit c06d3c6
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [ aj-main ]
pull_request:
branches: [ aj-main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# depth 0 makes the whole history checked out, and without it the build and tests differ, because default
# depth of 1 might easily fetch a non-tagged commit, hence the version isn't semantic but commit has only
fetch-depth: 0
- name: Print version tag
run: git describe --tags --dirty=-dirty --always
- name: Set up Go
uses: actions/setup-go@v4
with:
cache-dependency-path: go.sum
go-version-file: go.mod
- name: Run unit tests
run: make test-unit
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish
run-name: Publishing ${{ github.event.workflow_run.head_commit.message }}

on:
workflow_run:
workflows: [ CI ]
types: [ completed ]
branches: [ aj-main ]

jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The triggering workflow passed'
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'
publish:
runs-on: ubuntu-latest
needs: [ on-success ]
steps:
- uses: actions/checkout@v3
with:
# depth 0 makes the whole history checked out, and without it the build and tests differ, because default
# depth of 1 might easily fetch a non-tagged commit, hence the version isn't semantic but commit has only
fetch-depth: 0
- name: Print version tag
run: git describe --tags --dirty=-dirty --always
- name: Set up Go
uses: actions/setup-go@v4
with:
cache-dependency-path: go.sum
go-version-file: go.mod
- name: Build project
run: make

0 comments on commit c06d3c6

Please sign in to comment.