Skip to content

Merge pull request #241 from yakio/update_link #272

Merge pull request #241 from yakio/update_link

Merge pull request #241 from yakio/update_link #272

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: subscan
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: subscan_test
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
os: [ubuntu-latest]
steps:
# Set up golang env
- name: Set up GO 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17
id: go
# Checkout Go module directory
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# Cache Go Modules
- name: Cache Go Modules
uses: actions/cache@v1
env:
cache-name: cache-go-modules
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
# Get Deps
- name: Get dependencies
run: go mod download
# Build packages
- name: Build
run: ./build.sh build
# Trigger api tests when merge
- name: Tests
run: |
cp configs/config.yaml.example configs/config.yaml
go test -v ./...
env:
REDIS_ADDR: localhost:6379
NETWORK_NODE: polkadot
MYSQL_HOST: 127.0.0.1
MYSQL_DB: test
TEST_MOD: true
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=3m