Skip to content

Commit

Permalink
Minimal set of working Gitea workflows. (#138)
Browse files Browse the repository at this point in the history
As a first step on https://git.vdb.to/cerc-io/laconicd/issues/116, provide a minimal set of actions which are either already working or expected to work on Gitea.

Reviewed-on: https://git.vdb.to/cerc-io/laconicd/pulls/138
Co-authored-by: Thomas E Lackey <[email protected]>
Co-committed-by: Thomas E Lackey <[email protected]>
  • Loading branch information
telackey authored and Thomas E Lackey committed Jan 23, 2024
1 parent e7bab9b commit 965d7db
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 4 deletions.
17 changes: 17 additions & 0 deletions .gitea/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build
on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- run: |
make build
20 changes: 20 additions & 0 deletions .gitea/workflows/deploy-contract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy Contract
on:
pull_request:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- name: Test contract
run: |
make contract-tools
# This seems to be an empty placeholder.
make test-contract
28 changes: 28 additions & 0 deletions .gitea/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish on release
on:
release:
types: [published]
jobs:
build:
name: Run docker build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run docker build
run: docker build -t cerc-io/laconicd -f Dockerfile .
- name: Get the version
id: vars
run: |
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})
- name: Tag docker image
run: docker tag cerc-io/laconicd git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.sha}}
- name: Tag docker image
run: docker tag git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.tag}}
- name: Docker Login
run: echo ${{ secrets.CICD_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
- name: Docker Push
run: docker push git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.sha}}
- name: Docker Push TAGGED
run: docker push git.vdb.to/cerc-io/laconicd/laconicd:${{steps.vars.outputs.tag}}

28 changes: 28 additions & 0 deletions .gitea/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: goreleaser

on:
push:
tags:
- "v*.*.*"
jobs:
goreleaser:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- name: release dry run
run: make release-dry-run
- name: setup release environment
env:
GITHUB_TOKEN: ${{ secrets.CICD_PUBLISH_TOKEN }}
run: |-
echo 'GITHUB_TOKEN=${{secrets.CICD_PUBLISH_TOKEN}}' > .release-env
- name: release publish
run: make release
42 changes: 42 additions & 0 deletions .gitea/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint
# Lint runs golangci-lint over the entire ethermint repository This workflow is
# run on every pull request and push to main The `golangci` will pass without
# running if no *.{go, mod, sum} files have been changed.
on:
pull_request:
push:
branches:
- main
jobs:
golangci:
name: Run golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- uses: actions/checkout@v3
- uses: golangci/[email protected]
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
args: --timeout 10m
github-token: ${{ secrets.github_token }}

python-lint:
# For compatibility with Gitea
env:
USER: root
name: Run flake8 on python integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v20
- uses: cachix/cachix-action@v12
with:
name: ethermint
- run: |
nix-shell -I nixpkgs=./nix -p test-env --run "make lint-py"
28 changes: 28 additions & 0 deletions .gitea/workflows/proto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Protobuf
# Protobuf runs buf (https://buf.build/) lint and check-breakage
# This workflow is only run when a .proto file has been changed
on:
pull_request:
paths:
- "proto/**"

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: bufbuild/[email protected]
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"

break-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bufbuild/[email protected]
- uses: bufbuild/buf-breaking-action@v1
with:
input: "proto"
against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto"
99 changes: 99 additions & 0 deletions .gitea/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Tests
on:
pull_request:
push:
branches:
- main
- release/**

jobs:
test-unit:
# This test case doesn't work in CI, run as root.
env:
SKIP_UNIT_TESTS: TestInitConfigNonNotExistError
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- uses: actions/checkout@v3
- name: Test
run: |
make test-unit
test-importer:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- uses: actions/checkout@v3
- name: test-importer
run: |
make test-import
test-rpc:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- uses: actions/checkout@v3
- name: Test rpc endpoint
run: |
make test-rpc
sdk_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout laconic-sdk
uses: actions/checkout@v3
with:
path: "./laconic-sdk/"
repository: cerc-io/laconic-sdk
fetch-depth: 0
ref: main
- name: Environment
run: ls -tlh && env

- name: Build laconicd container
working-directory: tests/sdk_tests
run: ./build-laconicd-container.sh

- name: Build laconic-sdk container
working-directory: laconic-sdk
run: ./scripts/build-sdk-test-container.sh

- name: Start containers
working-directory: tests/sdk_tests
run: docker compose up -d

- name: Run tests
working-directory: tests/sdk_tests
run: ./run-tests.sh

- name: Start containers (auctions enabled)
working-directory: tests/sdk_tests
env:
TEST_AUCTION_ENABLED: true
run: docker compose up -d

- name: Run auction tests
working-directory: tests/sdk_tests
run: ./run-tests.sh test:auctions

- name: Start containers (expiry enabled)
working-directory: tests/sdk_tests
env:
TEST_REGISTRY_EXPIRY: true
run: docker compose up -d

- name: Run nameservice expiry tests
working-directory: tests/sdk_tests
run: ./run-tests.sh test:nameservice-expiry
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
if: env.GIT_DIFF

python-lint:
# For compatibility with Gitea
env:
USER: root
name: Run flake8 on python integration tests
runs-on: ubuntu-latest
steps:
Expand All @@ -49,4 +52,4 @@ jobs:
**/**.py
- run: |
nix-shell -I nixpkgs=./nix -p test-env --run "make lint-py"
if: env.GIT_DIFF
if: env.GIT_DIFF
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ TEST_TARGETS := test-unit test-unit-cover test-race
# Test runs-specific rules. To add a new test target, just add
# a new rule, customise ARGS or TEST_PACKAGES ad libitum, and
# append the new rule to the TEST_TARGETS list.
test-unit: ARGS=-timeout=10m -race -test.v
test-unit: ARGS=-timeout=10m -race -test.v -skip $(SKIP_UNIT_TESTS)
test-unit: TEST_PACKAGES=$(PACKAGES_UNIT)

test-race: ARGS=-race
Expand All @@ -334,7 +334,7 @@ else
endif

test-import:
go test -run TestImporterTestSuite -v --vet=off github.com/cerc-io/laconicd/tests/importer
go test -run TestImporterTestSuite -timeout=20m -v --vet=off github.com/cerc-io/laconicd/tests/importer

test-rpc:
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"
Expand Down
2 changes: 1 addition & 1 deletion scripts/integration-test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ echo "done sleeping"
set +e

if [[ -z $TEST || $TEST == "rpc" || $TEST == "pending" ]]; then
time_out=300s
time_out=900s
if [[ $TEST == "pending" ]]; then
time_out=60m0s
fi
Expand Down

0 comments on commit 965d7db

Please sign in to comment.