update dependecies #1211
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: CI | |
on: | |
push: | |
release: | |
types: [released] | |
env: | |
REGISTRY: "ghcr.io" | |
REGISTRY_BASE_URI: ghcr.io/nrel/alfalfa | |
jobs: | |
pre-commit: | |
name: Pre-commit checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
with: | |
extra_args: --all-files | |
unit-tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
# use a newer version of poetry in this test, but | |
# poetry in the dockerfile is a bit older because | |
# of a urllib3 issue | |
poetry-version: 1.3.1 | |
- name: Install poetry dependencies | |
run: | | |
poetry install | |
- name: Runner Details | |
run: | | |
cat /etc/issue | |
python --version | |
- name: Start dependencies | |
run: | | |
printenv | |
docker compose up -d mongo redis minio mc goaws | |
- name: Run tests with pytest | |
run: | | |
poetry run pytest | |
simulation-tests: | |
name: Run simulation tests in worker | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
uses: docker/bake-action@v2 | |
with: | |
files: docker-compose.yml, docker-compose.dev.yml | |
set: | | |
web.cache-from=type=gha,scope=web:${{ github.ref_name }} | |
worker.cache-from=type=gha,scope=worker:${{ github.ref_name }} | |
worker.output=type=docker | |
# only need to start the worker which saves time here because | |
# the webpack calling on the web container for .dev.yml can take some | |
# time. | |
- name: Build and run stack | |
env: | |
GIT_COMMIT: ${{ github.sha }} | |
run: | | |
printenv | |
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d worker mongo redis minio mc goaws | |
- name: Dump docker logs before tests | |
uses: jwalton/gh-docker-logs@v1 | |
- name: Run job tests in Docker worker container | |
run: | | |
sleep 30 | |
docker exec alfalfa-worker-1 bash -c "cd /alfalfa && poetry run pytest -m docker tests/jobs -o log_cli=true -o log_level=info" | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v1 | |
integration-tests: | |
name: Run integration tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
# use a newer version of poetry in this test, but | |
# poetry in the dockerfile is a bit older because | |
# of a urllib3 issue | |
poetry-version: 1.3.1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
uses: docker/bake-action@v2 | |
with: | |
files: docker-compose.yml | |
set: | | |
web.cache-from=type=gha,scope=web:${{ github.ref_name }} | |
web.output=type=docker | |
worker.cache-from=type=gha,scope=worker:${{ github.ref_name }} | |
worker.output=type=docker | |
- name: Run stack | |
env: | |
GIT_COMMIT: ${{ github.sha }} | |
run: | | |
printenv | |
docker compose up -d --scale worker=2 | |
- name: Wait for web server | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: "http://localhost/" | |
responseCode: 200 | |
timeout: 120000 | |
interval: 500 | |
- name: Dump docker logs before tests | |
uses: jwalton/gh-docker-logs@v1 | |
- name: Run tests with pytest | |
run: | | |
poetry install | |
poetry run pytest --timeout=600 -m "integration" | |
- name: Run worker scale tests with pytest | |
run: | | |
poetry run pytest -m "scale" | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v1 | |
integration-tests-historian: | |
name: Run integration tests with historian | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Install poetry | |
uses: abatilo/[email protected] | |
with: | |
# use a newer version of poetry in this test, but | |
# poetry in the dockerfile is a bit older because | |
# of a urllib3 issue | |
poetry-version: 1.3.1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
uses: docker/bake-action@v2 | |
with: | |
load: true | |
files: docker-compose.yml, docker-compose.dev.yml, docker-compose.historian.yml | |
set: | | |
web.cache-from=type=gha,scope=web:${{ github.ref_name }} | |
web.output=type=docker | |
worker.cache-from=type=gha,scope=worker:${{ github.ref_name }} | |
worker.output=type=docker | |
grafana.cache-from=type=gha,scope=grafana:${{ github.ref_name }} | |
grafana.output=type=docker | |
- name: Build and run stack | |
env: | |
GIT_COMMIT: ${{ github.sha }} | |
run: | | |
export HISTORIAN_ENABLE=true | |
printenv | |
docker compose -f docker-compose.yml -f docker-compose.historian.yml up -d --scale worker=2 | |
- name: Wait for web server | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: "http://localhost/" | |
responseCode: 200 | |
timeout: 120000 | |
interval: 500 | |
- name: Dump docker logs before tests | |
uses: jwalton/gh-docker-logs@v1 | |
- name: Run tests with pytest | |
run: | | |
poetry install | |
poetry run pytest --timeout=600 -m "integration" | |
- name: Run worker scale tests with pytest | |
run: | | |
poetry run pytest -m "scale" | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v1 | |
publish: | |
needs: [pre-commit, unit-tests, simulation-tests, integration-tests, integration-tests-historian] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Log into container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: | | |
${{ env.REGISTRY_BASE_URI }}/worker | |
${{ env.REGISTRY_BASE_URI }}/web | |
${{ env.REGISTRY_BASE_URI }}/grafana | |
tags: | | |
type=ref,event=branch | |
type=sha | |
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} | |
type=semver,pattern={{major}},enable=${{ github.event_name == 'release' }} | |
- name: Build | |
uses: docker/bake-action@v2 | |
with: | |
files: | | |
docker-compose.yml | |
docker-compose.historian.yml | |
set: | | |
web.cache-from=type=gha,scope=web:${{ github.ref_name }} | |
worker.cache-from=type=gha,scope=worker:${{ github.ref_name }} | |
grafana.cache-from=type=gha,scope=grafana:${{ github.ref_name }} | |
web.cache-to=type=gha,mode=max,scope=web:${{ github.ref_name }} | |
worker.cache-to=type=gha,mode=max,scope=worker:${{ github.ref_name }} | |
grafana.cache-to=type=gha,mode=max,scope=grafana:${{ github.ref_name }} | |
load: true | |
- name: Tag and push images | |
run: ./.github/workflows/tag_push_docker.sh |