fix: enable template for unit test #317
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: Tests | |
on: | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
push: | |
paths-ignore: | |
- 'README.md' | |
# schedule: | |
# - cron: '0 13 * * *' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
id: go | |
- name: Get dependencies | |
run: | | |
go mod download | |
- name: Build | |
run: | | |
go build -v . | |
test: | |
name: Matrix Test | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
- '1.3.9' | |
- '1.4.6' | |
- '1.5.2' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Build the docker-compose stack | |
env: | |
APPLICATION_SECRETS: ${{ secrets.APPLICATION_SECRETS }} | |
run: | | |
echo $APPLICATION_SECRETS | base64 -d > .github/docker/application-secrets.yml | |
docker-compose -f docker-compose-ci.yml pull | |
docker-compose -f docker-compose-ci.yml up -d zookeeper kafka elasticsearch vault | |
sleep 30 | |
docker-compose -f docker-compose-ci.yml up -d | |
sleep 30 | |
echo "\echo 'path \"*\" {capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\", \"sudo\"]}' | vault policy write admins -" | docker exec --interactive terraform-provider-kestra_vault_1 sh - | |
docker exec terraform-provider-kestra_vault_1 vault auth enable userpass | |
docker exec terraform-provider-kestra_vault_1 vault write auth/userpass/users/john \ | |
password=foo \ | |
policies=admins \ | |
token_period=1s | |
docker ps -a | |
docker logs terraform-provider-kestra_kestra_1 | |
curl "127.27.27.27:9200" > /dev/null | |
curl -X POST "127.27.27.27:8080/api/v1/users" > /dev/null | |
curl -H "Content-Type: application/x-ndjson" -XPOST "127.27.27.27:9200/_bulk?pretty" --data-binary @.github/workflows/index.jsonl | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.18' | |
id: go | |
- name: Get dependencies | |
run: | | |
go mod download | |
- name: Terraform acceptance tests | |
timeout-minutes: 10 | |
env: | |
TF_ACC: "1" | |
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} | |
KESTRA_URL: "http://127.27.27.27:8080" | |
KESTRA_USERNAME: [email protected] | |
KESTRA_PASSWORD: pass | |
run: | | |
go test -v -cover ./internal/provider/ | |
# Slack | |
- name: Slack notification | |
uses: 8398a7/action-slack@v3 | |
if: failure() && github.event_name != 'pull_request' | |
with: | |
status: ${{ job.status }} | |
job_name: Matrix Test | |
fields: repo,commit,action,ref,job,took | |
username: GitHub Actions | |
icon_emoji: ':github-actions:' | |
channel: 'C02DQ1A7JLR' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} |