Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: only ref to workflows directory are allowed #54

Merged
merged 8 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions .github/workflow_calls/common.yml

This file was deleted.

62 changes: 55 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
default: false
pull_request:
branches:
- master
- main
- release-*

concurrency:
Expand All @@ -18,12 +18,60 @@ concurrency:

jobs:
build_cmd:
uses: ./.github/workflow_calls/common.yml@test
with:
debug: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug }}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: "checkout repo"
uses: actions/checkout@v3
- name: "setup golang"
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: "try to use build cache"
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "build cmd"
run: make
- name: "set up tmate session if necessary"
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug }}
uses: mxschmitt/action-tmate@v3

build:
needs: build_cmd
uses: ./.github/workflow_calls/common.yml@test
with:
debug: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug }}
runs-on: ubuntu-latest
steps:
- name: "checkout repo"
uses: actions/checkout@v3
- name: "setup golang"
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: "try to use build cache"
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "build all"
run: make build
- name: "set up tmate session if necessary"
if: ${{ failure() && inputs.debug }}
uses: mxschmitt/action-tmate@v3
- name: "set up tmate session if necessary"
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug }}
uses: mxschmitt/action-tmate@v3
34 changes: 27 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ on:
required: false
default: false
workflow_run:
workflows: ["build"]
branches:
- master
- release-*
workflows:
- build
types:
- completed

Expand All @@ -21,6 +19,28 @@ concurrency:

jobs:
test:
uses: ./.github/workflow_calls/common.yml@test
with:
debug: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug }}
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
runs-on: ubuntu-latest
steps:
- name: "checkout repo"
uses: actions/checkout@v3
- name: "setup golang"
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: "try to use build cache"
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "test all"
run: make test
- name: "set up tmate session if necessary"
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug }}
uses: mxschmitt/action-tmate@v3