Skip to content

Commit

Permalink
ci: improve github actions (cosmos#13358)
Browse files Browse the repository at this point in the history
* ci: improve github actions

* updates

* revert title change

* updates

* implement feedback

* Update go.mod

Co-authored-by: Marko <[email protected]>
  • Loading branch information
julienrbrt and tac0turtle authored Sep 21, 2022
1 parent 7eb259f commit c297caa
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 188 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build SimApp
# This workflow is run on pushes to main & every Pull Requests where a .go, .mod, .sum have been changed
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
permissions:
contents: read

concurrency: ci-${{ github.ref }}

jobs:
build:
runs-on: buildjet-4vcpu-ubuntu-2004
strategy:
matrix:
go-arch: ["amd64", "arm", "arm64"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
- name: Build Legacy
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false COSMOS_BUILD_OPTIONS=legacy make build

- name: Build Cosmovisor
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor
17 changes: 17 additions & 0 deletions .github/workflows/clean-action-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Remove GitHub Action Old Artifacts

on:
schedule:
# Every day at 1am
- cron: "0 1 * * *"

jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: "7 days"
17 changes: 0 additions & 17 deletions .github/workflows/clean-artifacts.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/e2e.yml

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Run Gosec
on:
pull_request:
paths:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
paths:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- "**/*.go"
- "go.mod"
- "go.sum"

jobs:
Gosec:
Expand Down
File renamed without changes.
12 changes: 2 additions & 10 deletions .github/workflows/sims-045.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ on:
release:
types: [published]

concurrency: ci-${{ github.ref }}

jobs:
cleanup-runs:
permissions:
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
runs-on: buildjet-4vcpu-ubuntu-2004
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
build:
runs-on: buildjet-4vcpu-ubuntu-2004
if: "!contains(github.event.head_commit.message, 'skip-sims')"
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/sims-046.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ on:
release:
types: [published]

concurrency: ci-${{ github.ref }}

jobs:
cleanup-runs:
permissions:
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
runs-on: buildjet-4vcpu-ubuntu-2004
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
build:
runs-on: buildjet-4vcpu-ubuntu-2004
if: "!contains(github.event.head_commit.message, 'skip-sims')"
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,9 @@ on:
release:
types: [published]

jobs:
cleanup-runs:
permissions:
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
runs-on: buildjet-4vcpu-ubuntu-2004
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
concurrency: ci-${{ github.ref }}

jobs:
build:
permissions:
contents: read # for actions/checkout to fetch code
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests E2E
# This workflow is run on pushes to main & every Pull Requests where a .go, .mod, .sum have been changed
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
paths:
- "**/*.go"
- "go.mod"
- "go.sum"

permissions:
contents: read

jobs:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: e2e tests
run: |
make test-e2e
30 changes: 30 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests Integration
# This workflow is run on pushes to main & every Pull Requests where a .go, .mod, .sum have been changed
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
paths:
- "**/*.go"
- "go.mod"
- "go.sum"

permissions:
contents: read

jobs:
test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: integration tests
run: |
make test-integration
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,9 @@ on:
release:
types: [published]

jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-arch: ["amd64", "arm", "arm64"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build

- name: Build cosmovisor
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor

- name: Install runsim
run: go install github.com/cosmos/tools/cmd/[email protected]
- uses: actions/cache@v3
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
concurrency: ci-${{ github.ref }}

jobs:
test-submodules:
runs-on: ubuntu-latest
container: tendermintdev/docker-tm-db-testing
Expand Down Expand Up @@ -104,7 +76,7 @@ jobs:
path: ./${{ matrix.part }}profile.out

sims-notify-success:
needs: [tests]
needs: tests
runs-on: ubuntu-latest
if: ${{ success() }}
steps:
Expand All @@ -130,7 +102,7 @@ jobs:
SLACK_FOOTER: ""

sims-notify-failure:
needs: [tests]
needs: tests
runs-on: ubuntu-latest
if: ${{ failure() }}
steps:
Expand Down
52 changes: 2 additions & 50 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,9 @@ on:
permissions:
contents: read

jobs:
cleanup-runs:
runs-on: buildjet-4vcpu-ubuntu-2004
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
build:
runs-on: buildjet-4vcpu-ubuntu-2004
strategy:
matrix:
go-arch: ["amd64", "arm", "arm64"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/**.go
**/go.mod
**/go.sum
- name: Get data from Go build cache
# if: env.GIT_DIFF
if: ${{ false }}
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
- name: Build Legacy
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false COSMOS_BUILD_OPTIONS=legacy make build

- name: Build cosmovisor
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor

- name: Install runsim
run: go install github.com/cosmos/tools/cmd/[email protected]
- uses: actions/cache@v3
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
concurrency: ci-${{ github.ref }}

jobs:
test-submodules:
runs-on: buildjet-4vcpu-ubuntu-2004
container: tendermintdev/docker-tm-db-testing
Expand Down Expand Up @@ -279,7 +232,6 @@ jobs:

test-sim-nondeterminism:
runs-on: buildjet-4vcpu-ubuntu-2004
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down
Loading

0 comments on commit c297caa

Please sign in to comment.