Skip to content

Commit

Permalink
run workflows on any branch, and ensure binaries and images will buil…
Browse files Browse the repository at this point in the history
…d from PRs
  • Loading branch information
capnspacehook committed Oct 30, 2022
1 parent 7c6c25a commit 364f21d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
pull_request:
branches:
- master
- "*"

workflow_dispatch: {}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
jobs:
release-binary:
runs-on: ubuntu-latest
if: contains(github.ref, 'tag')
if: github.ref_type == 'tag'
permissions:
id-token: write
contents: write
Expand Down Expand Up @@ -57,10 +57,10 @@ jobs:
- name: Install cosign
uses: sigstore/cosign-installer@main

- name: Install docker buildx
- name: Install Docker buildx
uses: docker/setup-buildx-action@v2

- name: Build list of docker tags to use
- name: Build list of Docker tags to use
id: tag-types
run: |
if [[ ${{ contains(github.ref, 'tag') }} == true ]]; then
Expand All @@ -83,7 +83,7 @@ jobs:
echo "EOF"
} >> "$GITHUB_ENV"
- name: Set docker labels and tags
- name: Set Docker labels and tags
id: metadata
uses: docker/metadata-action@v4
with:
Expand All @@ -103,7 +103,7 @@ jobs:
id: get-tag
uses: olegtarasov/[email protected]

- name: Build and push docker image
- name: Build and push Docker image
id: build-push
uses: docker/build-push-action@v3
with:
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
pull_request:
branches:
- master
- "*"

workflow_dispatch: {}

Expand All @@ -27,6 +27,10 @@ jobs:
check-latest: true
cache: true

- name: Ensure main package builds
run: |
go build
- name: Run tests
run: |
go test -race -timeout 5m -v ./...
Expand All @@ -48,3 +52,21 @@ jobs:
- name: Fuzz code for 10 minutes
run: |
go test -fuzz Fuzz -run DONOT -fuzztime 10m
build-image:
runs-on: ubuntu-latest
# only run this check on pull requests, pushes to master will trigger
# an image release
if: contains(github.ref, 'pull')
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Docker buildx
uses: docker/setup-buildx-action@v2

- name: Ensure Docker image builds
uses: docker/build-push-action@v3
with:
push: false
tags: ghcr.io/${{ github.repository }}:build-test
2 changes: 1 addition & 1 deletion .github/workflows/vuln.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
pull_request:
branches:
- master
- "*"

workflow_dispatch: {}

Expand Down

0 comments on commit 364f21d

Please sign in to comment.