Skip to content

Commit

Permalink
Merge pull request #12322 from hashicorp/ci-gha
Browse files Browse the repository at this point in the history
ci: turn on testing in github actions
  • Loading branch information
shoenig committed Mar 18, 2022
2 parents bd71f20 + 665967c commit 7ff71ad
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 0 deletions.
140 changes: 140 additions & 0 deletions .github/workflows/test-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Core CI Tests
on:
push:
branches-ignore:
- main
- release-**
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.changelog/*'
- '.tours/*'
- 'contributing/*'
- 'demo/*'
- 'dev/*'
- 'e2e/terraform/*'
- 'integrations/*'
- 'pkg/*'
- 'scripts/*'
- 'terraform/*'
- 'ui/*'
- 'website/*'
env:
GO_VERSION: 1.17.7
GOBIN: /usr/local/bin
GOTESTARCH: amd64
CONSUL_VERSION: 1.11.3
VAULT_VERSION: 1.9.3
NOMAD_SLOW_TEST: 0
NOMAD_TEST_LOG_LEVEL: ERROR
jobs:
checks:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # needs tags for checkproto
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -checks
- name: Run make check
run: |
make bootstrap
make check
compile:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
runs-on: ${{matrix.os}}
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -compile
- name: Run make dev
env:
GOBIN: ${{env.GOROOT}}/bin # windows kludge
run: |
make bootstrap
make dev
tests-api:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -api
- name: Run API tests
env:
GOTEST_MOD: api
run: |
make bootstrap
make generate-all
make test-nomad-module
tests-pkgs:
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
pkg:
- acl
- client
- client/allocdir
- client/allochealth
- client/allocrunner
- client/allocwatcher
- client/config
- client/consul
- client/devicemanager
- client/dynamicplugins
- client/fingerprint
# - client/lib/...
- client/logmon
- client/pluginmanager
- client/state
- client/stats
- client/structs
- client/taskenv
- command
- command/agent
# - drivers/docker
# - drivers/exec
- drivers/java
- drivers/rawexec
- helper/...
- internal/...
- jobspec/...
- lib/...
- nomad
- nomad/deploymentwatcher
- nomad/stream
- nomad/structs
- nomad/volumewatcher
- plugins/...
- scheduler/...
- testutil
steps:
- uses: actions/checkout@v2
- uses: magnetikonline/action-golang-cache@v1
with:
go-version: ${{env.GO_VERSION}}
cache-key-suffix: -pkgs
- name: Run Matrix Tests
env:
GOTEST_PKGS: ./${{matrix.pkg}}
run: |
make bootstrap
make generate-all
hc-install vault ${{env.VAULT_VERSION}}
hc-install consul ${{env.CONSUL_VERSION}}
sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers
sudo -E env "PATH=$PATH" make test-nomad
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ deps: ## Install build and development dependencies
go install github.com/bufbuild/buf/cmd/buf@v0.36.0
go install github.com/hashicorp/go-changelog/cmd/changelog-build@latest
go install golang.org/x/tools/cmd/stringer@v0.1.8
go install gophers.dev/cmds/hc-install/cmd/hc-install@v1.0.1

.PHONY: lint-deps
lint-deps: ## Install linter dependencies
Expand Down
3 changes: 3 additions & 0 deletions scripts/update_golang_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sed -i'' -e "s|/golang:[.0-9]*|/golang:${golang_version}|g" .circleci/config.yml
sed -i'' -e "s|GOLANG_VERSION:[ \"]*[.0-9]*\"*|GOLANG_VERSION: ${golang_version}|g" \
.circleci/config.yml

sed -i'' -e "s|GO_VERSION:[ \"]*[.0-9]*\"*|GO_VERSION: ${golang_version}|g" \
.github/workflows/test-core.yaml

sed -i'' -e "s|\\(Install .Go\\) [.0-9]*|\\1 ${golang_version}|g" \
contributing/README.md

Expand Down

0 comments on commit 7ff71ad

Please sign in to comment.