Merge pull request #151 from go-gandi/pat-ci #186
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: Lint and Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: --all-files --show-diff-on-failure | |
test: | |
name: Acceptance Tests | |
# Secrets (sandbox token) are not available on forks | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Test with apikey | |
env: | |
GANDI_URL: https://api.sandbox.gandi.net | |
GANDI_KEY: ${{ secrets.GANDI_SANDBOX_KEY }} | |
GANDI_SHARING_ID: a2f9c3dc-ab0e-11ee-b064-00163e6722b2 | |
run: | | |
make testacc | |
- name: Test with personal access token | |
env: | |
GANDI_URL: https://api.sandbox.gandi.net | |
GANDI_PERSONAL_ACCESS_TOKEN: ${{ secrets.GANDI_SANDBOX_PERSONAL_ACCESS_TOKEN }} | |
run: | | |
make testacc | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
needs: lint | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
asset_name: terraform-provider-gandi-linux_amd64 | |
- os: macos-latest | |
asset_name: terraform-provider-gandi-darwin_amd64 | |
- os: windows-latest | |
asset_name: terraform-provider-gandi-windows_amd64 | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build | |
run: | | |
make cibuild | |
# This still does something weird, comment out for now | |
# - name: TF Provider Lint | |
# uses: bflad/tfproviderlint-github-action@master | |
# if: runner.os == 'Linux' | |
# with: | |
# args: "./..." | |
- uses: actions/upload-artifact@v2 | |
name: Upload | |
with: | |
name: build-artifact | |
path: ${{ matrix.asset_name }} |