FIX: Pass lxd socket to test #33
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: build-cloud-autoscaler | |
on: | |
push: | |
paths: | |
- "**/**.go" | |
- go.mod | |
- go.sum | |
branches: | |
- '*' | |
tags: | |
- ci-build | |
- ci-test | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
REGISTRY: ${{ secrets.REGISTRY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
AWS_ACCESSKEY: ${{ secrets.AWS_ACCESSKEY }} | |
AWS_PROFILE: ${{ secrets.AWS_PROFILE }} | |
AWS_REGION: ${{ vars.AWS_REGION }} | |
AWS_SECRETKEY: ${{ secrets.AWS_SECRETKEY }} | |
IAM_ROLE_ARN: ${{ secrets.IAM_ROLE_ARN }} | |
PRIVATE_DOMAIN_NAME: ${{ secrets.PRIVATE_DOMAIN_NAME }} | |
ROUTE53_ZONEID: ${{ secrets.ROUTE53_ZONEID }} | |
SEED_IMAGE: ${{ vars.SEED_IMAGE }} | |
SEED_USER: ${{ vars.SEED_USER }} | |
SSH_KEYNAME: ${{ secrets.SSH_KEYNAME }} | |
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }} | |
VPC_SECURITY_GROUPID: ${{ secrets.VPC_SECURITY_GROUPID }} | |
VPC_SUBNET_ID: ${{ secrets.VPC_SUBNET_ID }} | |
jobs: | |
build: | |
if: startsWith(github.ref, 'refs/tags/ci-test') == false | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache vendor | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-vendor | |
with: | |
path: vendor | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Build binary | |
shell: bash | |
run: | | |
make -e REGISTRY=$REGISTRY -e TAG=build-ci build-in-docker | |
test: | |
if: startsWith(github.ref, 'refs/tags/ci-build') == false | |
name: Test | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install LXD | |
uses: canonical/setup-lxd@main | |
with: | |
channel: 6.1/stable | |
- name: Cache vendor | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-vendor | |
with: | |
path: vendor | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: test-in-docker | |
shell: bash | |
run: | | |
./test/bin/test.sh | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@v2.3.0 | |
- name: Prepare SonarCloud | |
shell: bash | |
run: sudo chown -R $USER .scannerwork |