Skip to content

Commit

Permalink
Merge branch 'release-0.2.0' into LCFS-1207-Followup-AutopopulateFuel…
Browse files Browse the repository at this point in the history
…Category-CI-Units
  • Loading branch information
areyeslo authored Dec 17, 2024
2 parents 39d0e62 + 2552cdf commit 99a42ce
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 48 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,36 @@ concurrency:

jobs:

install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

set-pre-release:
name: Calculate pre-release number
runs-on: ubuntu-latest
needs: [install-oc]

outputs:
output1: ${{ steps.set-pre-release.outputs.PRE_RELEASE }}
Expand All @@ -49,6 +76,12 @@ jobs:
- name: Check out repository
uses: actions/[email protected]

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/docker-auto-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
with:
python-version: "3.10.13"

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install Docker Compose
run: |
sudo apt-get update
Expand All @@ -32,18 +27,10 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-poetry-${{ hashFiles('backend/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Cache Docker images
uses: actions/cache@v3
with:
path: /var/lib/docker
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-
- name: Install Poetry
run: pip install poetry==1.6.1

Expand Down Expand Up @@ -110,7 +97,6 @@ jobs:
report_individual_runs: "true"
deduplicate_classes_by_file_name: "true"


frontend-tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -127,7 +113,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand Down Expand Up @@ -162,4 +148,4 @@ jobs:
check_name: "Frontend Test Results"
fail_on: "errors"
report_individual_runs: "true"
deduplicate_classes_by_file_name: "true"
deduplicate_classes_by_file_name: "true"
46 changes: 46 additions & 0 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,51 @@ concurrency:
cancel-in-progress: true

jobs:
install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

get-version:
if: >
(github.event.action == 'labeled' && github.event.label.name == 'build' && github.event.pull_request.base.ref == github.event.repository.default_branch) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == github.event.repository.default_branch)
name: Retrieve version
runs-on: ubuntu-latest
needs: [install-oc]

outputs:
output1: ${{ steps.get-version.outputs.VERSION }}

steps:

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
Expand Down Expand Up @@ -69,6 +103,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
Expand Down Expand Up @@ -123,6 +163,12 @@ jobs:
ref: main
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/pr-teardown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,48 @@ concurrency:
cancel-in-progress: true

jobs:
install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

teardown:
if: >
(github.event.action == 'unlabeled' && github.event.label.name == 'build') ||
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'build') )
name: PR Teardown
runs-on: ubuntu-latest
needs: [install-oc]
timeout-minutes: 60

steps:

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/prod-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,38 @@ concurrency:
cancel-in-progress: true

jobs:
install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

# Read the image tag from test environment
get-image-tag:

name: Get the image-tag from values-test.yaml
runs-on: ubuntu-latest
needs: [install-oc]

outputs:
IMAGE_TAG: ${{ steps.get-image-tag.outputs.IMAGE_TAG }}
Expand Down Expand Up @@ -84,6 +110,12 @@ jobs:
approvers: AlexZorkin,kuanfandevops,hamed-valiollahi,airinggov,areyeslo,dhaselhan,Grulin
minimum-approvals: 2
issue-title: "LCFS ${{env.IMAGE_TAG }} Prod Deployment at ${{ env.CURRENT_TIME }}."

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,36 @@ concurrency:
cancel-in-progress: true

jobs:
install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

run-tests:
name: Run Tests
runs-on: ubuntu-latest
needs: [install-oc]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -229,6 +256,12 @@ jobs:
minimum-approvals: 1
issue-title: "LCFS ${{ env.VERSION }}-${{ env.PRE_RELEASE }} Test Deployment"

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Update default_carbon_intensity for 'Other diesel' fuel type
Revision ID: 5d729face5ab
Revises: 7ae38a8413ab
Create Date: 2024-12-12 21:43:01.414475
"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "5d729face5ab"
down_revision = "7ae38a8413ab"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.execute(
"""
UPDATE fuel_type
SET default_carbon_intensity = 100.21
WHERE fuel_type_id = 20
"""
)


def downgrade() -> None:
op.execute(
"""
UPDATE fuel_type
SET default_carbon_intensity = 94.38
WHERE fuel_type_id = 20
"""
)
2 changes: 1 addition & 1 deletion backend/lcfs/db/seeders/common/seed_fuel_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"fossil_derived": true,
"other_uses_fossil_derived": true,
"provision_1_id": 1,
"default_carbon_intensity": 94.38,
"default_carbon_intensity": 100.21,
"units": "L",
"unrecognized": false
}
Expand Down
Loading

0 comments on commit 99a42ce

Please sign in to comment.