Skip to content

Commit

Permalink
feat: Overhaul Github Actions (gnolang#2040)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnavarro authored and théo dub committed May 15, 2024
1 parent a612a11 commit 4138eef
Show file tree
Hide file tree
Showing 32 changed files with 397 additions and 783 deletions.
24 changes: 4 additions & 20 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
codecov:
require_ci_to_pass: false
require_ci_to_pass: true
notify:
wait_for_ci: true

ignore:
- misc

comment:
require_changes: false

Expand All @@ -25,7 +22,7 @@ coverage:
patch:
default:
target: auto
threshold: 100 # Allows PRs without tests, overall stats count.
threshold: 10 # Let's decrease this later.
base: auto
if_no_uploads: error
if_not_found: success
Expand All @@ -40,18 +37,5 @@ flag_management:
target: auto
threshold: 10 # Let's decrease this later.
- type: patch
target: auto # Allows PRs without tests, overall stats count.
threshold: 100
individual_flags:
- name: tm2
paths:
- tm2
- name: gnovm
paths:
- gnovm
- name: gno.land
paths:
- gno.land
- name: misc
paths:
- misc
target: auto # Let's decrease this later.
threshold: 10
3 changes: 1 addition & 2 deletions .github/workflows/examples.yml → .github/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
run: |
export LOG_PATH_DIR=${{ runner.temp }}/logs
mkdir -p $LOG_PATH_DIR
echo "LOG_LEVEL=debug" >> $GITHUB_ENV
echo "LOG_PATH_DIR=$LOG_PATH_DIR" >> $GITHUB_ENV
- run: go install -v ./gnovm/cmd/gno
Expand Down Expand Up @@ -95,4 +94,4 @@ jobs:
# Find all directories containing gno.mod file
find ./examples -name "gno.mod" -execdir go run "$GNO_CMD" mod tidy \;
# Check if there are changes after running gno mod tidy
git diff --exit-code || (echo "Some gno.mod files are not tidy, please run 'make tidy'." && exit 1)
git diff --exit-code || (echo "Some gno.mod files are not tidy, please run 'make tidy'." && exit 1)
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
name: docker
on:
pull_request:
paths:
- "**"
- "!misc/**"
- "!docs/**"
- "!**.md"
push:
branches: [ "master" ]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/autocounterd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/benchmark-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ name: run benchmarks on every PR
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check:
uses: ./.github/workflows/benchmark.yml
uses: ./.github/workflows/benchmark_template.yml
secrets: inherit
with:
publish: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: '0 0 * * *' # run on default branch every day
jobs:
publish:
uses: ./.github/workflows/benchmark.yml
uses: ./.github/workflows/benchmark_template.yml
secrets: inherit
with:
publish: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
test-flags:
required: true
type: string

env:
CGO_ENABLED: 0

jobs:
benchmarks:
if: ${{ github.repository == 'gnolang/gno' }}
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/build_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_call:
inputs:
modulepath:
required: true
type: string
go-version:
required: true
type: string

jobs:
generated:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

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

- name: Check generated files are up to date
working-directory: ${{ inputs.modulepath }}
run: |
go generate -x ./...
if [ "$(git status -s)" != "" ]; then
echo "command 'go generate' creates file that differ from git tree, please run 'go generate' and commit:"
git status -s
exit 1
fi
36 changes: 0 additions & 36 deletions .github/workflows/codegen.yml

This file was deleted.

84 changes: 21 additions & 63 deletions .github/workflows/contribs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,32 @@ name: contribs

on:
push:
branches: [ "master" ]
pull_request:
branches:
- master
workflow_dispatch:
pull_request:
paths:
- "contribs/**"
- ".github/workflows/contribs.yml"
- "gnovm/**.go"
- "gno.land/**.go"
- "tm2/**.go"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
- ".github/**"

jobs:
install:
strategy:
fail-fast: false
matrix:
goversion:
- "1.22.x"
program:
- "gnomd"
- "gnodev"
- "gnofaucet"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goversion }}
- run: make install.${{ matrix.program }}
working-directory: contribs

test:
strategy:
fail-fast: false
matrix:
goversion: # two latest versions
- "1.21.x"
- "1.22.x"
program:
- "gnodev"
setup:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
programs: ${{ steps.set-matrix.outputs.programs }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
- run: make test.${{ matrix.program }}
working-directory: contribs

lint:
- id: set-matrix
run: echo "::set-output name=programs::$(ls -d contribs/*/ | cut -d/ -f2 | jq -R -s -c 'split("\n")[:-1]')"
main:
needs: setup
strategy:
fail-fast: false
matrix:
goversion:
- "1.22.x"
program:
- "gnodev"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
- run: make lint.${{ matrix.program }}
working-directory: contribs

fail-fast: false
matrix:
program: ${{ fromJson(needs.setup.outputs.programs) }}
name: Run Main
uses: ./.github/workflows/main_template.yml
with:
modulepath: contribs/${{ matrix.program }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
54 changes: 0 additions & 54 deletions .github/workflows/db-tests.yml

This file was deleted.

Loading

0 comments on commit 4138eef

Please sign in to comment.