Standardize on GitHub Actions for CI #65
Workflow file for this run
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: build-test | |
on: | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
- 'CHANGELOG.md' | |
- '.changelog/**' | |
- '.tours/**' | |
- 'contributing/**' | |
- 'demo/**' | |
- 'dev/**' | |
- 'e2e/terraform/**' | |
- 'e2e/ui/**' | |
- 'integrations/**' | |
- 'pkg/**' | |
- 'scripts/**' | |
- 'terraform/**' | |
- 'ui/**' | |
- 'website/**' | |
push: | |
branches: | |
- main | |
- release/** | |
paths-ignore: | |
- 'README.md' | |
- 'CHANGELOG.md' | |
- '.changelog/**' | |
- '.tours/**' | |
- 'contributing/**' | |
- 'demo/**' | |
- 'dev/**' | |
- 'e2e/terraform/**' | |
- 'e2e/ui/**' | |
- 'integrations/**' | |
- 'pkg/**' | |
- 'scripts/**' | |
- 'terraform/**' | |
- 'ui/**' | |
- 'website/**' | |
env: | |
VAULT_VERSION: 1.4.1 | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
jobs: | |
build-binaries: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Setup go | |
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | |
with: | |
go-version-file: ".go-version" | |
- run: make deps | |
- uses: "./.github/actions/install-buf" | |
- run: make generate-structs | |
- name: prepare ui cache | |
run: |- | |
git config --global --add safe.directory /__w/nomad/nomad | |
git log -n 1 --pretty=format:%H ui > /tmp/ui-sha | |
- name: prepare ui | |
run: |- | |
if [[ -f ~/tmp/ui-assets/bindata_assetfs.go ]]; then | |
cp /tmp/ui-assets/bindata_assetfs.go ./command/agent/bindata_assetfs.go | |
exit 0 | |
fi | |
./scripts/vagrant-linux-unpriv-ui.sh | |
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" | |
export PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" | |
# shellcheck source=./.nvm/nvm.sh | |
. ~/.nvm/nvm.sh | |
cd ui && yarn install --frozen-lockfile && cd .. | |
JOBS=2 make ember-dist static-assets | |
mkdir -p /tmp/ui-assets | |
cp ./command/agent/bindata_assetfs.go /tmp/ui-assets/bindata_assetfs.go | |
- name: build binaries | |
run: |- | |
go_tags="ui $(grep -e '^GO_TAGS ?=' ./GNUmakefile | cut -d= -f2)" | |
export GO_TAGS="$go_tags" | |
make pkg/windows_amd64.zip pkg/linux_amd64.zip | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
path: pkg | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
path: "/tmp/ui-assets" | |
test-e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Setup go | |
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | |
- run: make deps | |
- run: make integration-test | |
- run: make e2e-test | |
test-ui: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: yarn install | |
run: cd ui && yarn install --frozen-lockfile | |
- name: lint:js | |
run: cd ui && yarn run lint:js | |
- name: lint:hbs | |
run: cd ui && yarn run lint:hbs | |
- name: Ember tests | |
run: mkdir -p /tmp/test-reports && cd ui && yarn test | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
path: "/tmp/test-reports" | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
path: "/tmp/test-reports" | |
test-windows: | |
strategy: | |
matrix: | |
include: | |
- { runner: windows-2019-16core, tag: ltsc2019 } | |
runs-on: ${{ matrix.runner }} | |
env: | |
GOTESTSUM_PATH: c:\tmp\test-reports | |
steps: | |
- name: Docker Info | |
run: docker version | |
- run: git config --global core.autocrlf false | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Setup go | |
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | |
with: | |
go-version-file: ".go-version" | |
- name: Show installed Go version | |
shell: bash | |
run: |- | |
export PATH=/c/go/bin:/c/gopath/bin:$PATH | |
go version | |
- uses: "./.github/actions/install-vault" | |
with: | |
version: "$VAULT_VERSION" | |
- run: vault version | |
- run: choco install make | |
- name: Install golang dependencies | |
shell: bash | |
run: |- | |
make deps | |
- name: Pre-download docker test image | |
shell: bash | |
run: |- | |
docker pull docker.mirror.hashicorp.services/hashicorpdev/busybox-windows:${{ matrix.tag }} | |
- name: Build nomad | |
shell: bash | |
run: |- | |
go install . | |
- name: Run tests with gotestsum | |
shell: bash | |
env: | |
BUSYBOX_IMAGE: docker.mirror.hashicorp.services/hashicorpdev/busybox-windows:${{ matrix.tag }} | |
run: |- | |
# Only test docker driver tests for now | |
export PATH=/c/go/bin:/c/gopath/bin:$PATH | |
gotestsum --format=short-verbose \ | |
--junitfile results.xml \ | |
github.com/hashicorp/nomad/drivers/docker \ | |
github.com/hashicorp/nomad/client/lib/fifo \ | |
github.com/hashicorp/nomad/client/logmon | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: results.xml | |
path: results.xml | |
permissions: | |
contents: read |