Skip to content

Commit

Permalink
Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nigeleke committed Oct 15, 2024
1 parent 193b54b commit ae93bac
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Run acceptance-cycle on develop commits.
#
# Acceptance cycle comprises:
# - run tests on develop
# - release into main with bumped versions
#
name: Acceptance Cycle

on:
push:
branches:
- develop

jobs:
acceptance:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --out xml
- name: Publish to Codecov
uses: codecov/codecov-action@v4

- name: Documentation
run: cargo doc --no-deps

release:
needs: acceptance
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build
run: |
git config --global user.email "[email protected]"
git config --global user.name "Nigel Eke"
git checkout main
git merge develop
cargo install cargo-workspaces
cargo workspaces -v version --allow-branch main --yes patch
25 changes: 25 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Quick feedback for unit tests on non-main commits.
#
name: Commit Cycle

on:
push:
branches-ignore:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Compile
run: cargo build --verbose

- name: Lint
run: cargo clippy

- name: Test
run: cargo test --verbose -- --show-output
53 changes: 53 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Run publish-cycle on main commits.
#
# Publish cycle comprises:
# - publish site, coverage reports and API documentation to https://nigeleke.github.io
#
name: Publish Cycle

on:
workflow_run:
workflows: ["Acceptance Cycle"]
branches: [develop]
types:
- completed

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build
run: |
cargo doc --no-deps
cargo install cargo-tarpaulin
cargo tarpaulin --out html --output-dir target/coverage
mkdir docs0
mkdir -p docs0/api
mkdir -p docs0/coverage
cp README.md docs0/
cp -R target/doc/* docs0/api
cp -R target/coverage/tarpaulin-report.html docs0/coverage/index.html
cargo tarpaulin --out xml
- name: Publish to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Publish
run: |
git config --global user.email "[email protected]"
git config --global user.name "Nigel Eke"
export VERSION=$(git describe --abbrev=0 --tags)
git checkout gh-pages
rm -rf docs
mv docs0 docs
git add .
git commit -m "Release $VERSION"
git push

0 comments on commit ae93bac

Please sign in to comment.