Bump slateci/github-actions from 16 to 17 (#297) #262
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: Integration Tests | |
concurrency: | |
group: inttests-${{ github.repository }} | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
slate-client-server-branch: | |
description: 'Branch under test (slate-client-server)' | |
required: false | |
default: master | |
type: string | |
slate-portal-branch: | |
description: 'Branch under test (slate-portal):' | |
required: false | |
default: master | |
type: string | |
slate-client-version: | |
description: 'Version of the SLATE client to use (e.g. 1.2.3):' | |
required: false | |
default: latest | |
type: string | |
kubernetes-version: | |
description: 'Version of Kubernetes to use (e.g. 1.24.9):' | |
required: false | |
default: '1.24.9' | |
type: string | |
env: | |
HELM_SECRETS_BACKEND: vals | |
MINIKUBE_VERSION: "1.30.1" | |
PYTHON_VERSION: '3.10.7' | |
SLATE_API_TOKEN: "12345A6A-AAA2-1234-A1A1-123A123A1234" | |
jobs: | |
workflow-inputs: | |
name: Display Workflow Inputs | |
runs-on: ubuntu-22.04 | |
if: github.event.inputs != '' | |
steps: | |
- name: Output inputs | |
run: |- | |
echo "## Workflow inputs" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo "${{ toJSON(github.event.inputs) }}" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
test: | |
name: Test | |
runs-on: ubuntu-22.04 | |
services: | |
chrome: | |
image: selenium/standalone-chrome:latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Check out slate-client-server repo | |
if: ${{ github.event.inputs.slate-client-server-branch == '' }} | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: ./slate-client-server | |
ref: refs/heads/master | |
repository: slateci/slate-client-server | |
- name: Check out specific branch of slate-client-server repo | |
if: ${{ github.event.inputs.slate-client-server-branch != '' }} | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: ./slate-client-server | |
ref: ${{ github.event.inputs.slate-client-server-branch }} | |
repository: slateci/slate-client-server | |
- name: Check out slate-portal repo | |
if: ${{ github.event.inputs.slate-portal-branch == '' }} | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: ./slate-portal | |
ref: refs/heads/master | |
repository: slateci/slate-portal | |
- name: Check out specific branch of slate-portal repo | |
if: ${{ github.event.inputs.slate-portal-branch != '' }} | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: ./slate-portal | |
ref: ${{ github.event.inputs.slate-portal-branch }} | |
repository: slateci/slate-portal | |
- name: Set Up Tools | |
uses: slateci/github-actions/.github/actions/gcloud-helm-setup-lite@v17 | |
with: | |
service_account: ${{ secrets.GCLOUD_SERVICE_ACCOUNT }} | |
workload_identity_provider: ${{ secrets.GCLOUD_WORKLOAD_IDENTITY_PROVIDER }} | |
- name: Create Minikube Cluster | |
if: ${{ github.event.inputs.kubernetes-version == '' }} | |
uses: medyagh/setup-minikube@master | |
with: | |
minikube-version: ${{ env.MINIKUBE_VERSION }} | |
driver: docker | |
container-runtime: containerd | |
kubernetes-version: "v1.24.9" | |
cni: calico | |
- name: Create Minikube Cluster | |
if: ${{ github.event.inputs.kubernetes-version != '' }} | |
uses: medyagh/setup-minikube@master | |
with: | |
minikube-version: ${{ env.MINIKUBE_VERSION }} | |
driver: docker | |
container-runtime: containerd | |
kubernetes-version: "v${{ github.event.inputs.kubernetes-version }}" | |
cni: calico | |
- name: Set up local namespace | |
working-directory: . | |
run: |- | |
minikube kubectl create namespace local | |
echo "MINIKUBE_IP=$(minikube ip)" >> $GITHUB_ENV | |
- name: Install the local Slate Client Server Helm chart | |
working-directory: ./slate-client-server/resources/chart | |
run: |- | |
helm secrets install slate-api-local . \ | |
-f ./vars/secrets.yml \ | |
-f ./vars/values.yml \ | |
-f ./vars/local/secrets.yml \ | |
-f ./vars/local/values.yml \ | |
--set-string apiToken=${{ env.SLATE_API_TOKEN }} \ | |
--set-string bootstrapUserFileAccessToken=${{ env.SLATE_API_TOKEN }} \ | |
-n local | |
- name: Install the local Slate Portal Helm chart | |
working-directory: ./slate-portal/resources/chart | |
run: |- | |
helm secrets install slate-portal-local . \ | |
-f ./vars/secrets.yml \ | |
-f ./vars/values.yml \ | |
-f ./vars/local/secrets.yml \ | |
-f ./vars/local/values.yml \ | |
--set-string apiToken=${{ env.SLATE_API_TOKEN }} \ | |
--set-string portalEndpoint=${{ env.MINIKUBE_IP }}:30008 \ | |
-n local | |
- name: Gather details for Minikube services | |
working-directory: . | |
run: |- | |
echo "SLATE_API_ENDPOINT=$(minikube service slate-api-local-service --url --namespace local)" >> $GITHUB_ENV | |
echo "SLATE_PORTAL_ENDPOINT=$(minikube service slate-portal-local-service --url --namespace local)" >> $GITHUB_ENV | |
- name: Check out portal-unit-test repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: ./portal-unit-test | |
ref: refs/heads/master | |
repository: slateci/portal-unit-test | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: 'x64' | |
- name: Install Selenium Python Bindings | |
working-directory: . | |
run: |- | |
pip install -U selenium | |
- name: Install the SLATE client | |
working-directory: . | |
run: |- | |
mkdir ./slate-client | |
cd ./slate-client | |
# Script variables: | |
GITHUB_RELEASES_URL="https://github.com/slateci/slate-client-server/releases" | |
if [[ "${{ github.event.inputs.slate-client-version }}" == "" ]] | |
then | |
SLATE_CLIENT_VERSION="latest" | |
else | |
SLATE_CLIENT_VERSION="${{ github.event.inputs.slate-client-version }}" | |
fi | |
echo "Downloading SLATE client version: \"$SLATE_CLIENT_VERSION\"..." | |
if [[ $SLATE_CLIENT_VERSION == "latest" ]] | |
then | |
curl -fsSL "${GITHUB_RELEASES_URL}/latest/download/slate-linux.tar.gz" -o slate-linux.tar.gz | |
curl -fsSL "${GITHUB_RELEASES_URL}/latest/download/slate-linux.sha256" -o slate-linux.sha256 | |
else | |
curl -fsSL "${GITHUB_RELEASES_URL}/download/v$SLATE_CLIENT_VERSION/slate-linux.tar.gz" -o slate-linux.tar.gz | |
curl -fsSL "${GITHUB_RELEASES_URL}/download/v$SLATE_CLIENT_VERSION/slate-linux.sha256" -o slate-linux.sha256 | |
fi | |
echo "Verifying download..." | |
sha256sum -c slate-linux.sha256 || exit 1 | |
echo "Adding SLATE client to path..." | |
tar xzvf slate-linux.tar.gz | |
echo "${{ github.workspace }}/slate-client" >> $GITHUB_PATH | |
- name: Await pods | |
uses: jupyterhub/action-k8s-await-workloads@v3 | |
with: | |
workloads: "" # all | |
namespace: local | |
timeout: 300 | |
max-restarts: 1 | |
- name: Kubernetes namespace report | |
uses: jupyterhub/action-k8s-namespace-report@v1 | |
if: always() | |
with: | |
namespace: local | |
- name: Verify Portal landing page is being served | |
working-directory: . | |
run: |- | |
curl ${{ env.SLATE_PORTAL_ENDPOINT }}/slate_portal | |
- name: Test connection to the API server | |
working-directory: . | |
run: |- | |
mkdir /home/runner/.slate | |
echo ${{ env.SLATE_API_TOKEN }} >> /home/runner/.slate/token | |
chmod 600 /home/runner/.slate/token | |
echo "==================================" | |
echo "= Connection Information =" | |
echo "==================================" | |
echo Endpoint: $(echo "$SLATE_API_ENDPOINT") | |
echo "" | |
echo "$(slate whoami 2>&1 | head -n 2)" | |
echo "" | |
slate version | |
echo "" | |
echo "" | |
- name: Seed test data | |
working-directory: . | |
run: |- | |
slate group create my-group --field 'Resource Provider' | |
slate cluster create my-cluster --group my-group --org SLATE --no-ingress -y | |
- name: Run Selenium tests | |
working-directory: ./portal-unit-test | |
run: |- | |
python main.py ${{ env.SLATE_PORTAL_ENDPOINT }} | |
notifications: | |
name: Notifications | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
if: ${{ always() && (needs.test.result == 'failure') }} | |
steps: | |
- name: Notify Slack of Failure | |
uses: slateci/github-actions/.github/actions/slack-notify-failure@v17 | |
with: | |
slack_bot_token: '${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}' |