Feature/dpr/feature development #167
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
name: "Run tests" | |
on: | |
- pull_request | |
env: | |
GOSSVERSION: v0.4.4 | |
jobs: | |
notify: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.head.repo.fork }} | |
steps: | |
- name: Notifiy about skips on forks | |
run: | | |
echo "::notice title=Skipping cloud tests::Because we're running from a fork, we'll skip cloud tests." | |
build-exclude: | |
runs-on: ubuntu-latest | |
outputs: | |
jobs: ${{ steps.build-exclude.outputs.jobs }} | |
steps: | |
- id: build-exclude | |
run: | | |
cat <<EOT > tmp.js | |
exclude=[{"flavour": "tanzu", "arch": "linux/arm64"}] | |
if (${{ github.event.pull_request.head.repo.fork }}) { | |
exclude = exclude.concat([{"flavour": "aws"}, {"flavour": "azure"}, {"flavour": "gcloud"}]) | |
} | |
console.log(JSON.stringify(exclude)) | |
EOT | |
echo "jobs=$(node tmp.js)" >> "$GITHUB_OUTPUT" | |
test: | |
needs: build-exclude | |
strategy: | |
matrix: | |
flavour: | |
# Commented for pricing reasons | |
#- aws | |
- azure | |
# Commented until gcloud playground exists | |
#- gcloud | |
- simple | |
- tanzu | |
arch: | |
- linux/amd64 | |
# Commented until Github supports arm64 runners | |
#- linux/arm64 | |
exclude: ${{ fromJSON(needs.build-exclude.outputs.jobs) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Setup Docker buildx | |
uses: docker/[email protected] | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Prepare flavour data (common) | |
run: | | |
mkdir .testbed | |
- name: Prepare flavour data (azure) | |
if: matrix.flavour == 'azure' | |
run: | | |
echo "AZ_SUBSCRIPTION=${{ secrets.TEST_AZURE_SUBSCRIPTION }}" > .testbed/.env | |
echo "AZ_K8S_CLUSTERS=${{ secrets.TEST_AZURE_K8SCLUSTERS }}" >> .testbed/.env | |
echo "AZ_TENANTID=${{ secrets.TEST_AZURE_TENANTID }}" >> .testbed/.env | |
echo "ARM_SUBSCRIPTION_ID=${{ secrets.TEST_AZURE_SUBSCRIPTION }}" >> .testbed/.env | |
echo "ARM_CLIENT_ID=${{ secrets.TEST_AZURE_CLIENT_ID }}" >> .testbed/.env | |
echo "ARM_CLIENT_SECRET=${{ secrets.TEST_AZURE_CLIENT_SECRET }}" >> .testbed/.env | |
echo "AZ_USE_ARM_SPI=true" >> .testbed/.env | |
- name: Prepare flavour data (aws) | |
if: matrix.flavour == 'aws' | |
run: | | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.TEST_AWS_ACCESS_KEY_ID }}" > .testbed/.env | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}" >> .testbed/.env | |
echo "AWS_DEFAULT_REGION=${{ secrets.TEST_AWS_DEFAULT_REGION }}" >> .testbed/.env | |
echo "AWS_K8S_CLUSTERS=${{ secrets.TEST_AWS_K8S_CLUSTERS }}" >> .testbed/.env | |
echo "AWS_SKIP_GPG=1" >> .testbed/.env | |
- name: Prepare flavour data (gcloud) | |
if: matrix.flavour == 'gcloud' | |
run: | | |
echo "${{ secrets.TEST_GCLOUD_KEY_JSON }}" | base64 -d > .testbed/gcloud_key.json | |
echo "GCLOUD_PROJECTID=${{ secrets.TEST_GCLOUD_PROJECT }}" > .testbed/.env | |
echo "GCLOUD_K8S_CLUSTERS=${{ secrets.TEST_GCLOUD_K8SCLUSTERS }}" >> .testbed/.env | |
echo "GCLOUD_KEYPATH=/flavour/gcloud_key.json" >> .testbed/.env | |
- name: Prepare flavour container | |
run: | | |
cat build/Dockerfile.prefix > Dockerfile | |
cat "flavour/${{ matrix.flavour }}/Dockerfile.flavour" >> Dockerfile | |
# Download mo | |
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo | |
chmod +x mo | |
cat build/Dockerfile.suffix.mo | BUILD_DATE=$(date -Iseconds) FLAVOUR=${{ matrix.flavour }} ./mo > build/Dockerfile.suffix | |
cat build/Dockerfile.suffix >> Dockerfile | |
rm mo | |
- name: build flavour container | |
id: build-and-push | |
uses: docker/[email protected] | |
with: | |
context: . | |
pull: true | |
tags: test-image-${{ matrix.flavour }}-${{ matrix.arch}}:local | |
load: true | |
no-cache: true | |
platforms: ${{ matrix.arch }} | |
- name: Run Tests | |
run: | | |
set -x | |
GOSS_ARCH=$(echo "${{ matrix.arch }}" | tr / -) | |
curl -sL "https://github.com/goss-org/goss/releases/download/${{ env.GOSSVERSION }}/goss-${GOSS_ARCH}" -o goss | |
chmod +x goss | |
go build cmd/tests/test-features.go | |
./test-features -c -f ${{ matrix.flavour }} -i test-image-${{ matrix.flavour }}-${{ matrix.arch }}:local -p ${{ matrix.arch }} -t ${PWD}/.testbed -g ${PWD}/goss -l debug | |
- name: Cleanup | |
run: | | |
rm -rf .testbed | |
rm goss |