golangicilint install #2
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] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: foreman | |
MYSQL_USER: foreman | |
MYSQL_PASSWORD: foreman | |
postgres: | |
image: postgres:9.6.2-alpine | |
env: | |
POSTGRES_DB: foreman | |
POSTGRES_USER: foreman | |
POSTGRES_PASSWORD: foreman | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.22.0 | |
- name: Install Dependencies | |
run: | | |
make mod-download | |
make tools | |
- name: Waiting for MySQL to be ready | |
run: | | |
for i in `seq 1 10`; | |
do | |
nc -z 127.0.0.1 3306 && echo Success && exit 0 | |
echo -n . | |
sleep 1 | |
done | |
echo Failed waiting for MySQL && exit 1 | |
- name: Lint | |
run: make lint | |
- name: Check dependencies for vulnerabilities | |
run: make check-mods || true | |
- name: Run tests | |
env: | |
MYSQL_CONNECTION: foreman:foreman@tcp(127.0.0.1:3306)/foreman?charset=utf8&parseTime=True | |
PG_CONNECTION: postgres://foreman:[email protected]:5432/foreman?sslmode=disable | |
run: | | |
make unit-test | |
make integration-test | |
- name: Upload reports to codecov | |
run: bash <(curl -s https://codecov.io/bash) | |
- name: Store test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-results | |
path: /tmp/test-reports |