Skip to content

Commit

Permalink
rename action to initialize-scubagoggles; move majority of steps out …
Browse files Browse the repository at this point in the history
…of workflow into action for reuse
  • Loading branch information
mitchelbaker-cisa committed Jul 26, 2024
1 parent e6a2bd7 commit a9e011a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 41 deletions.
51 changes: 51 additions & 0 deletions .github/actions/initialize-scubagoggles/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Initialize ScubaGoggles
inputs:
python-version:
required: true
default: "3.12"
cache-dependency-path:
required: true
default: "requirements.txt"
operating-system:
required: true
default: "windows"
opa-version:
required: true
default: "0.60.0"

runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
cache-dependency-path: ${{ inputs.cache-dependency-path }}

- name: Setup virtualenv for Windows
if: ${{ inputs.operating-system == "windows" }}
shell: powershell
run: |
pip install virtualenv
python -m venv .venv
.venv\Scripts\activate
- name: Setup virtualenv for MacOS
if: ${{ inputs.operating-system == "macos" }}
shell: bash
run: |
pip install virtualenv
virtualenv -p python .venv
source .venv/bin/activate
- name: Install dependencies
run: |
python -m pip install .
pip install -r requirements.txt
pip install pytest
pip uninstall numpy
pip install -y numpy==1.26.4
- name: Download OPA executable
run: python download_opa.py -v ${{ inputs.opa-version }} -os ${{ inputs.operating-system }}
18 changes: 0 additions & 18 deletions .github/actions/initialize-smoke-test/action.yml

This file was deleted.

32 changes: 9 additions & 23 deletions .github/workflows/run_smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Initialize smoke test
uses: ./.github/actions/initialize-smoke-test

- name: Initialize ScubaGoggles
uses: ./.github/actions/initialize-scubagoggles
with:
python-version: "3.12"
cache-dependency-path: "requirements.txt"

- name: Setup virtualenv
run: |
pip install virtualenv
python -m venv .venv
.venv\Scripts\activate
- name: Install dependencies
run: |
python -m pip install .
pip install -r requirements.txt
pip install pytest
pip uninstall numpy
pip install numpy==1.26.4
- name: Download OPA executable
run: python download_opa.py -v 0.60.0 -os windows
operating-system: "windows"
opa-version: "0.60.0"

- name: Execute ScubaGoggles and check for correct output
run: |
pip show scubagoggles
# Setup credentials for service account
Set-Content -Path credentials.json -Value $env:GWS_GITHUB_AUTOMATION_CREDS
pytest -s ./Testing/Functional/SmokeTests/ --subjectemail="$env:GWS_SUBJECT_EMAIL"
Expand All @@ -68,11 +52,13 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Initialize smoke test
uses: ./.github/actions/initialize-smoke-test
- name: Initialize ScubaGoggles
uses: ./.github/actions/initialize-scubagoggles
with:
python-version: "3.12"
cache-dependency-path: "requirements.txt"
operating-system: "macos"
opa-version: "0.60.0"

- name: Execute ScubaGoggles and check for correct output
run: |
Expand Down

0 comments on commit a9e011a

Please sign in to comment.