Skip to content

chore(deps): update dependency boto3 to v1.34.3 - autoclosed #997

chore(deps): update dependency boto3 to v1.34.3 - autoclosed

chore(deps): update dependency boto3 to v1.34.3 - autoclosed #997

Workflow file for this run

name: CI/CD
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
on:
pull_request:
branches: ["main"]
paths-ignore: ["docs/**"]
push:
branches: ["main"]
paths-ignore: ["docs/**"]
tags:
- "v*"
jobs:
# Runs the ruff & black linting steps inside the specified containers rather than on the VM host.
# Because of this the network configuration changes from host based network to a container network.
linter_ruff:
runs-on: ubuntu-22.04
container: python:3.10-slim-bullseye
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- name: Install Dependencies
run: |
pip install -q ruff==0.0.270
- name: ruff
run: |
ruff check --format=github .
linter_black:
runs-on: ubuntu-22.04
container: python:3.10-slim-bullseye
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- name: Install Dependencies
run: |
pip install -q black==23.3.0
- name: black
run: |
black . --check
# Runs the frontend linting steps on the VM
linter_stylelint:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
- name: Install Dependencies
run: |
npm ci
- name: Stylelint
run: |
npm run lint:style
linter_eslint:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
- name: Install Dependencies
run: |
npm ci
- name: ESLint
run: |
npm run lint:js
linter_prettier:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
- name: Install Dependencies
run: |
npm ci
- name: Prettier
run: |
npm run lint:format
shellcheck:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- name: Install Dependencies
shell: bash
run: |
sudo apt install shellcheck -y
- name: Run shellcheck
shell: bash
run: |
echo "${{ github.ref }}"
bash -c 'shopt -s globstar; shellcheck ./*.sh;'
# Runs the python test suite on the VM
test:
runs-on: ubuntu-22.04
needs:
[
linter_ruff,
linter_black,
linter_stylelint,
linter_eslint,
linter_prettier,
shellcheck,
]
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==1.6.1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "poetry.lock"
- name: Install Dependencies
shell: bash
run: |
sudo apt update --yes --quiet
export DEBIAN_FRONTEND=noninteractive
export TZ=Africa/Lusaka
sudo apt install --yes --quiet --no-install-recommends tzdata libssl-dev ffmpeg
sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen
sudo locale-gen
sudo ln -fs /usr/share/zoneinfo/Africa/Lusaka /etc/localtime
sudo dpkg-reconfigure tzdata
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
export LC_ALL=en_US.UTF-8
poetry install
- name: Test with unittest
shell: bash
env:
OPENAI_API_KEY: "fake_key"
COHERE_API_KEY: "another_fake_key"
AWS_ACCESS_KEY_ID: "1234567890"
AWS_SECRET_ACCESS_KEY: "fake_secret_key"
AWS_REGION_NAME: "any-region"
AWS_BUCKET_NAME: "bucket-name"
run: |
poetry run invoke test
- name: "Upload coverage data"
uses: actions/upload-artifact@v3
with:
name: covdata
path: coverage.*
coverage:
name: Coverage
needs: test
runs-on: ubuntu-22.04
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==1.6.1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "poetry.lock"
- name: "Download coverage data"
uses: actions/download-artifact@v3
with:
name: covdata
- name: "Extract total coverage"
run: |
export TOTAL=$(python -c "import json;print(round(json.load(open('coverage.json'))['totals']['percent_covered']))")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: "Create coverage badge"
if: (github.repository == 'engineervix/zed-news') && (github.ref == 'refs/heads/main')
uses: schneegans/[email protected]
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: f4b1128b188c4e29722bc879e4ab6574
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}
# Runs the next steps on the VM
# Creates a GitHub Release when the lint & test jobs succeeds, and only on pushes to tags.
release:
needs:
[
linter_ruff,
linter_black,
linter_stylelint,
linter_eslint,
linter_prettier,
shellcheck,
test,
]
permissions:
contents: write
if: needs.test.result == 'success' && startsWith( github.ref, 'refs/tags/v' )
runs-on: ubuntu-22.04
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install invoke colorama tomli
- name: Get the version
id: get_version
run: |
echo "${{ github.ref }}"
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Generate Release Title
id: get_release_title
shell: bash
run: |
export TODAY="($(TZ=Africa/Lusaka date --iso))"
echo ::set-output name=RELEASE_NAME::"${{ steps.get_version.outputs.VERSION }} $TODAY"
- name: Extract Release Notes
# This creates a file LATEST_RELEASE_NOTES.md in the parent directory (../)
shell: bash
run: |
invoke get-release-notes
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.get_release_title.outputs.RELEASE_NAME }}
body_path: ../LATEST_RELEASE_NOTES.md