Remove test block #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- hiep/add-github-actions | |
tags: | |
- '*' | |
jobs: | |
build_lint_test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.3 | |
- name: Print Go environment | |
run: go env | |
- name: Cache Go modules | |
id: go-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.go/pkg/mod | |
~/.cache/go-build | |
key: go-mod-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
go-mod- | |
- name: Install Dependencies | |
run: sudo apt-get install libzmq3-dev | |
- name: Build staking-indexer | |
run: make build | |
- name: Lint | |
run: | | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2 | |
./bin/golangci-lint run --timeout 5m0s | |
- name: Run tests | |
run: make test | |
- name: Run integration tests | |
run: make test-e2e | |
build_docker: | |
runs-on: ubuntu-22.04 | |
needs: build_lint_test | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
tags: staking-indexer:${{ github.sha }} | |
outputs: type=docker,dest=/tmp/staking-indexer.tar | |
- name: Upload Docker image to workspace | |
uses: actions/upload-artifact@v4 | |
with: | |
name: staking-indexer | |
path: /tmp/staking-indexer.tar | |
push_docker: | |
runs-on: ubuntu-22.04 | |
needs: build_docker | |
steps: | |
- name: Download Docker image from workspace | |
uses: actions/download-artifact@v4 | |
with: | |
name: staking-indexer | |
path: /tmp/ | |
- name: Load Docker image | |
run: docker load -i /tmp/staking-indexer.tar | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Docker image | |
run: | | |
docker tag staking-indexer:${{ github.sha }} ${{ secrets.DOCKERHUB_REGISTRY }}/staking-indexer:${{ github.sha }} | |
docker push ${{ secrets.DOCKERHUB_REGISTRY }}/staking-indexer:${{ github.sha }} |