Skip to content

Commit

Permalink
feat: hooks and labels
Browse files Browse the repository at this point in the history
  • Loading branch information
chaaz committed Sep 22, 2020
1 parent 0ab3f2b commit 200a748
Show file tree
Hide file tree
Showing 28 changed files with 651 additions and 193 deletions.
9 changes: 0 additions & 9 deletions .github/snippets/check-cargo.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/snippets/check-versio.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/snippets/get-cargo-minimal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
key: get-cargo-minimal
value:
- name: Get cargo stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
2 changes: 1 addition & 1 deletion .github/snippets/get-cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ value:
components: rustfmt
- name: Find paths
id: cargo-find-paths
run: echo '::set-output name=cargo-lock-glob::${{ matrix.root }}/**/Cargo.lock'
run: 'echo ::set-output name=cargo-lock-glob::"${{ matrix.root }}"/**/Cargo.lock'
- name: Cache cargo and target
uses: actions/cache@v1
with:
Expand Down
14 changes: 10 additions & 4 deletions .github/snippets/job-cargo-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ value:
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.project-matrixes.outputs.cargo-matrix) }}
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: SNIPPET_not-skip-ci
defaults:
run:
working-directory: ${{ matrix.root }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- SNIPPET_check-cargo
- name: Checkout code
uses: actions/checkout@v2
- SNIPPET_get-cargo
- name: Check structure
run: cargo clippy
- name: Check format
run: cargo +nightly fmt -- --check
- name: Check tests
run: cargo test
24 changes: 24 additions & 0 deletions .github/snippets/job-cratesio-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
key: job-cratesio-publish
value:
needs:
- project-matrixes
- versio-release
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.project-matrixes.outputs.cargo-matrix)}}
if: SNIPPET_not-skip-ci
defaults:
run:
working-directory: ${{ matrix.root }}
steps:
- name: Checkout release
uses: actions/checkout@v2
with:
ref: main
- SNIPPET_get-cargo
- name: Login to crates.io
run: cargo login ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Publish to crates.io
run: cargo publish
10 changes: 9 additions & 1 deletion .github/snippets/job-project-matrixes.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
key: job-project-matrixes
value:
runs-on: ubuntu-latest
if: SNIPPET_not-skip-ci
outputs:
cargo-matrix: ${{ steps.find-cargo-matrix.outputs.matrix }}
all-matrix: ${{ steps.find-all-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- SNIPPET_matrix
- name: Get versio
uses: chaaz/versio-actions/install@v1
- name: Find cargo matrix
id: find-cargo-matrix
run: 'echo "::set-output name=matrix::{\"include\":$(versio -l none info -l cargo -R -N)}"'
- name: Find all matrix
id: find-all-matrix
run: 'echo "::set-output name=matrix::{\"include\":$(versio -l none info -a -R -N)}"'
15 changes: 11 additions & 4 deletions .github/snippets/job-versio-checks.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
key: job-versio-checks
value:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: SNIPPET_not-skip-ci
steps:
- name: Checkout code
uses: actions/checkout@v2
- SNIPPET_check-versio
- name: Checkout code
uses: actions/checkout@v2
- name: Get versio
uses: chaaz/versio-actions/install@v1
- name: Fetch history
run: git fetch --unshallow
- name: Check projects
run: versio check
- name: Output plan
run: versio plan
17 changes: 17 additions & 0 deletions .github/snippets/job-versio-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
key: job-versio-release
value:
needs:
- cargo-checks
- versio-checks
runs-on: ubuntu-latest
if: SNIPPET_not-skip-ci
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get versio
uses: chaaz/versio-actions/install@v1
- SNIPPET_get-cargo-minimal
- name: Fetch history
run: git fetch --unshallow
- name: Generate release
run: versio release
10 changes: 0 additions & 10 deletions .github/snippets/matrix.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/snippets/not-skip-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
key: not-skip-ci
value: "!contains(github.event.head_commit.message, 'skip ci')"
40 changes: 2 additions & 38 deletions .github/workflows-src/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,5 @@ jobs:
project-matrixes: SNIPPET_job-project-matrixes
versio-checks: SNIPPET_job-versio-checks
cargo-checks: SNIPPET_job-cargo-checks

versio-release:
needs:
- cargo-checks
- versio-checks
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get versio
uses: chaaz/versio-actions/install@v1
- name: Fetch history
run: git fetch --unshallow
- name: Generate release
run: versio release

cargo-post:
needs:
- project-matrixes
- versio-release
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.project-matrixes.outputs.cargo-matrix)}}
if: "!contains(github.event.head_commit.message, 'skip ci')"
defaults:
run:
working-directory: ${{ matrix.root }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- SNIPPET_get-cargo
- name: Login to crates.io
run: cargo login ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Publish to crates.io
run: cargo publish
versio-release: SNIPPET_job-versio-release
cratesio-publish: SNIPPET_job-cratesio-publish
9 changes: 5 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# DO NOT EDIT
# Created from "/Users/charlie/Documents/Projects/gits/versio-new/.github/workflows-src/pr.yml".
# Created from template "pr.yml".
name: pr
"on":
- workflow_dispatch
Expand All @@ -11,6 +11,7 @@ env:
jobs:
project-matrixes:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
outputs:
cargo-matrix: "${{ steps.find-cargo-matrix.outputs.matrix }}"
all-matrix: "${{ steps.find-all-matrix.outputs.matrix }}"
Expand All @@ -21,10 +22,10 @@ jobs:
uses: chaaz/versio-actions/install@v1
- name: Find cargo matrix
id: find-cargo-matrix
run: "echo \"::set-output name=matrix::{\\\"include\\\": $(versio -l none info -i 0 -R -N)}\""
run: "echo \"::set-output name=matrix::{\\\"include\\\":$(versio -l none info -l cargo -R -N)}\""
- name: Find all matrix
id: find-all-matrix
run: "echo \"::set-output name=matrix::{\\\"include\\\": $(versio -l none info -a -R -N)}\""
run: "echo \"::set-output name=matrix::{\\\"include\\\":$(versio -l none info -a -R -N)}\""
versio-checks:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
Expand Down Expand Up @@ -63,7 +64,7 @@ jobs:
components: rustfmt
- name: Find paths
id: cargo-find-paths
run: "echo '::set-output name=cargo-lock-glob::${{ matrix.root }}/**/Cargo.lock'"
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock"
- name: Cache cargo and target
uses: actions/cache@v1
with:
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# DO NOT EDIT
# Created from "/Users/charlie/Documents/Projects/gits/versio-new/.github/workflows-src/release.yml".
# Created from template "release.yml".
name: release
"on":
- workflow_dispatch
Expand All @@ -11,6 +11,7 @@ env:
jobs:
project-matrixes:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
outputs:
cargo-matrix: "${{ steps.find-cargo-matrix.outputs.matrix }}"
all-matrix: "${{ steps.find-all-matrix.outputs.matrix }}"
Expand All @@ -21,10 +22,10 @@ jobs:
uses: chaaz/versio-actions/install@v1
- name: Find cargo matrix
id: find-cargo-matrix
run: "echo \"::set-output name=matrix::{\\\"include\\\": $(versio -l none info -i 0 -R -N)}\""
run: "echo \"::set-output name=matrix::{\\\"include\\\":$(versio -l none info -l cargo -R -N)}\""
- name: Find all matrix
id: find-all-matrix
run: "echo \"::set-output name=matrix::{\\\"include\\\": $(versio -l none info -a -R -N)}\""
run: "echo \"::set-output name=matrix::{\\\"include\\\":$(versio -l none info -a -R -N)}\""
versio-checks:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
Expand Down Expand Up @@ -63,7 +64,7 @@ jobs:
components: rustfmt
- name: Find paths
id: cargo-find-paths
run: "echo '::set-output name=cargo-lock-glob::${{ matrix.root }}/**/Cargo.lock'"
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock"
- name: Cache cargo and target
uses: actions/cache@v1
with:
Expand All @@ -86,11 +87,20 @@ jobs:
uses: actions/checkout@v2
- name: Get versio
uses: chaaz/versio-actions/install@v1
- name: Get cargo stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@v1
with:
path: "~/.cargo/registry\n~/.cargo/git\n"
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
- name: Fetch history
run: git fetch --unshallow
- name: Generate release
run: versio release
cargo-post:
cratesio-publish:
needs:
- project-matrixes
- versio-release
Expand All @@ -102,8 +112,10 @@ jobs:
run:
working-directory: "${{ matrix.root }}"
steps:
- name: Checkout code
- name: Checkout release
uses: actions/checkout@v2
with:
ref: main
- name: Get cargo stable
uses: actions-rs/toolchain@v1
with:
Expand All @@ -116,7 +128,7 @@ jobs:
components: rustfmt
- name: Find paths
id: cargo-find-paths
run: "echo '::set-output name=cargo-lock-glob::${{ matrix.root }}/**/Cargo.lock'"
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock"
- name: Cache cargo and target
uses: actions/cache@v1
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/target
TODO*
/.versio-paused
/.versio-paused
/.versio-paused
5 changes: 4 additions & 1 deletion .versio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ projects:
- name: "versio"
id: 0
tag_prefix: ""
changelog: 'CHANGELOG.html'
labels: cargo
changelog: "CHANGELOG.html"
version:
file: "Cargo.toml"
toml: "package.version"
hooks:
post_write: cargo fetch

sizes:
use_angular: true
Expand Down
Loading

0 comments on commit 200a748

Please sign in to comment.