Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.9' into merge-from-two-nine
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlanigan committed Jan 19, 2024
2 parents 9e87604 + 3b2375d commit d21de75
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/terraform-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "Terraform Provider for Juju Smoke"
on:
push:
branches: [2.9, 3.*]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '**.go'
- 'go.mod'
- '.github/workflows/terraform-smoke.yml'
workflow_dispatch:

permissions:
contents: read

jobs:

smoke:
name: Terraform Smoke
runs-on: [self-hosted, linux, x64, aws, xlarge]
if: github.event.pull_request.draft == false
steps:

- name: Install Dependencies
shell: bash
run: |
set -euxo pipefail
echo "/snap/bin" >> $GITHUB_PATH
sudo DEBIAN_FRONTEND=noninteractive apt install -y expect
- name: Checkout juju
uses: actions/checkout@v3

- name: Setup LXD
uses: canonical/setup-lxd@4e959f8e0d9c5feb27d44c5e4d9a330a782edee0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: setup env
shell: bash
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install local Juju
shell: bash
run: |
make go-install
- name: Bootstrap Juju - localhost
shell: bash
run: |
set -euxo pipefail
juju bootstrap localhost c \
--constraints "arch=$(go env GOARCH)"
juju version
- name: Find terraform provider for juju latest release
uses: actions/checkout@v3
with:
repository: 'juju/terraform-provider-juju'
#path: terraform-provider-juju
fetch-depth: 0

- name: Checkout terraform provider for juju latest release
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $LATEST_TAG
- name: Set environment to configure provider for test
run: |
CONTROLLER=$(juju whoami --format yaml | yq .controller)
echo "JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")')" >> $GITHUB_ENV
echo "JUJU_USERNAME=$(juju show-controller | yq .$CONTROLLER.account.user)" >> $GITHUB_ENV
echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password)" >> $GITHUB_ENV
echo "JUJU_CA_CERT<<EOF" >> $GITHUB_ENV
juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Run terraform provider for juju ACC tests
shell: bash
env:
TF_ACC: "1"
TEST_CLOUD: lxd
run: |
go mod download
go test -timeout 40m -v -cover ./internal/provider/

0 comments on commit d21de75

Please sign in to comment.