Add support for Snapshot Management #323
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
on: [push, pull_request] | |
name: Test | |
jobs: | |
lint: | |
# Separate golangci-lint into its own job because it can override go | |
# env variables and it runs jobs in parallel: | |
# https://github.com/golangci/golangci-lint-action#how-to-use | |
name: Runs go linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.17 | |
- uses: actions/checkout@v3 | |
with: | |
# we depend on full git history for linters | |
fetch-depth: 0 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Required: the version of golangci-lint is required and must be | |
# specified without patch version: we always use the latest patch | |
# version. | |
version: v1.54 | |
args: --verbose --timeout=10m | |
test: | |
strategy: | |
matrix: | |
go-version: [1.18.x] | |
os: [ubuntu-latest] | |
os-major-version: | |
- "2-opensearch" | |
include: | |
- os-major-version: "2-opensearch" | |
version: 2 | |
oss-image: "opensearchproject/opensearch" | |
OS_IMAGE: "opensearchproject/opensearch:2" | |
OS_DASHBOARD_IMAGE: "opensearchproject/opensearch-dashboards:2" | |
OPENSEARCH_PREFIX: "plugins.security" | |
needs: [lint] | |
name: Test against OS ${{ matrix.os-major-version }} on ${{ matrix.go-version }}/${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
OS_IMAGE: "${{matrix.OS_IMAGE}}" | |
OS_DASHBOARD_IMAGE: "${{matrix.OS_DASHBOARD_IMAGE}}" | |
OPENSEARCH_PREFIX: "${{matrix.OPENSEARCH_PREFIX}}" | |
OSS_ENV_VAR: "${{matrix.OSS_ENV_VAR}}" | |
steps: | |
- name: Prepare tests | |
run: | | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
# we depend on full git history for linters | |
fetch-depth: 0 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod # Module download cache | |
~/.cache/go-build # Build cache (Linux) | |
~/Library/Caches/go-build # Build cache (Mac) | |
'%LocalAppData%\go-build' # Build cache (Windows) | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
- name: Run Docker containers | |
run: docker-compose up --detach | |
env: | |
OSS_IMAGE: "${{ matrix.oss-image }}:${{ matrix.version }}" | |
OS_COMMAND: "${{matrix.OS_COMMAND}}" | |
- name: Check Docker containers | |
run: docker ps -a | |
# While docker/OS is booting up, run the linters | |
- name: Get tools | |
run: | | |
./script/install-tools | |
- name: Install managed version of terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.0.11 | |
terraform_wrapper: false | |
- name: Run check scripts | |
run: | | |
./script/test-mod-tidy | |
./script/test-terraform-fmt | |
- name: Wait for Opensearch | |
# ensure that OS has come up and is available | |
run: | | |
./script/wait-for-endpoint --timeout=20 http://admin:admin@localhost:9200 | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
- name: Run the tests | |
run: | | |
export OPENSEARCH_URL=http://admin:admin@localhost:9200 | |
export TF_LOG=INFO | |
TF_ACC=1 go test ./... -v -parallel 20 -cover -short | |
# check goreleaser config for deprecations | |
curl -sfL https://git.io/goreleaser | sh -s -- check | |
release: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [test] | |
runs-on: ubuntu-latest | |
name: Release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18.x | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Run GoReleaser | |
uses: goreleaser/[email protected] | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |