add self hosted machine #430
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: bin-ci | |
on: | |
push: | |
branches: '**' | |
env: | |
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }} | |
jobs: | |
action-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Lint workflow | |
uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint:latest | |
get-go-version: | |
needs: action-lint | |
uses: ./.github/workflows/reusable-get-go-version.yml | |
lint: | |
defaults: | |
run: | |
working-directory: ./consul-lambda/consul-lambda-registrator | |
runs-on: ubuntu-latest | |
needs: | |
- get-go-version | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | |
with: | |
go-version: ${{ needs.get-go-version.outputs.go-version }} | |
cache-dependency-path: ./consul-lambda/go.sum | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0 | |
with: | |
version: v1.51 | |
args: "--verbose --enable gofmt" | |
only-new-issues: false | |
skip-pkg-cache: true | |
skip-build-cache: true | |
working-directory: ./consul-lambda/consul-lambda-registrator | |
test: | |
name: unit test (consul-version=${{ matrix.consul-version }}) | |
strategy: | |
matrix: | |
consul-version: | |
- 1.15.2 | |
- 1.15.2+ent | |
platform: | |
- { goos: "linux", goarch: "amd64", runs-on: "ubuntu-latest"} | |
- { goos: "linux", goarch: "arm64", runs-on: ['self-hosted', 'Linux', 'ARM64']} | |
needs: | |
- get-go-version | |
defaults: | |
run: | |
working-directory: ./consul-lambda/consul-lambda-registrator | |
env: | |
TEST_RESULTS_DIR: /tmp/test-results | |
GOTESTSUM_VERSION: 1.8.0 | |
runs-on: ${{ matrix.platform.runs-on }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | |
with: | |
go-version: ${{ needs.get-go-version.outputs.go-version }} | |
cache-dependency-path: ./consul-lambda/go.sum | |
- name: Install Consul | |
shell: bash | |
run: | | |
CONSUL_VERSION="${{ matrix.consul-version }}" | |
PLATFORM="${{ matrix.platform.goos }}_${{ matrix.platform.goarch }}" | |
FILENAME="consul_${CONSUL_VERSION}_${PLATFORM}.zip" | |
curl -sSLO "https://releases.hashicorp.com/consul/${CONSUL_VERSION}/${FILENAME}" && \ | |
unzip "${FILENAME}" -d /usr/local/bin && \ | |
rm "${FILENAME}" | |
consul version | |
- name: Build | |
run: go build -v ./... | |
- name: Setup gotestsum | |
shell: bash | |
run: | | |
PLATFORM="${{ matrix.platform.goos }}_${{ matrix.platform.goarch }}" | |
url=https://github.com/gotestyourself/gotestsum/releases/download | |
curl -sSL "${url}/v${{ env.GOTESTSUM_VERSION }}/gotestsum_${{ env.GOTESTSUM_VERSION }}_${PLATFORM}.tar.gz" | \ | |
tar -xz --overwrite -C /usr/local/bin gotestsum | |
- name: Test | |
run: | | |
mkdir -p "$TEST_RESULTS_DIR/${{ matrix.consul-version }}/json" | |
read -r -a PACKAGE_NAMES <<<"$(go list ./... | grep -v 'mocks' | grep -v 'testing' | tr '\n' ' ')" | |
echo "Testing $(echo "${PACKAGE_NAMES[@]}" | wc -w) packages" | |
if echo "${{ matrix.consul-version }}" | grep -q '.*\+ent'; then | |
FLAG=-enterprise | |
fi | |
gotestsum \ | |
--format=short-verbose \ | |
--jsonfile "$TEST_RESULTS_DIR/${{ matrix.consul-version }}/json/go-test-race.log" \ | |
--junitfile "$TEST_RESULTS_DIR/${{ matrix.consul-version }}/gotestsum-report.xml" -- \ | |
-race "${PACKAGE_NAMES[@]}" \ | |
-- "$FLAG" | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: test-results | |
path: ${{ env.TEST_RESULTS_DIR }}/${{ matrix.consul-version }} |