Skip to content

Commit

Permalink
Merge pull request #6 from canonical/TELCO-000-use-common-workflow-de…
Browse files Browse the repository at this point in the history
…finitions

Updates GH workflows to use common definitions from sdcore-github-workflows repo
  • Loading branch information
Gmerold authored Jun 1, 2023
2 parents ddc62a3 + c561e65 commit 16e35fd
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 211 deletions.
63 changes: 2 additions & 61 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
Expand All @@ -17,54 +6,6 @@ on:
- cron: '25 13 * * 0'

jobs:
analyze:
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
uses: canonical/sdcore-github-workflows/.github/workflows/codeql-analysis.yml@main
42 changes: 0 additions & 42 deletions .github/workflows/integration-test.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/lint-report.yaml

This file was deleted.

17 changes: 10 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ on:

jobs:
lint-report:
uses: ./.github/workflows/lint-report.yaml
uses: canonical/sdcore-github-workflows/.github/workflows/lint-report.yaml@main

static-analysis:
uses: ./.github/workflows/static-analysis.yaml
uses: canonical/sdcore-github-workflows/.github/workflows/static-analysis.yaml@main

unit-tests-with-coverage:
uses: ./.github/workflows/unit-test.yaml
uses: canonical/sdcore-github-workflows/.github/workflows/unit-test.yaml@main

integration-test:
uses: ./.github/workflows/integration-test.yaml
uses: canonical/sdcore-github-workflows/.github/workflows/integration-test.yaml@main
with:
charm-file-name: "sdcore-pcf_ubuntu-22.04-amd64.charm"

publish-charm:
name: Publish Charm
Expand All @@ -29,6 +31,7 @@ jobs:
- unit-tests-with-coverage
- integration-test
if: ${{ github.ref_name == 'main' }}
uses: ./.github/workflows/publish-charm.yaml
secrets:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }}
uses: canonical/sdcore-github-workflows/.github/workflows/publish-charm.yaml@main
with:
charm-file-name: "sdcore-pcf_ubuntu-22.04-amd64.charm"
secrets: inherit
31 changes: 4 additions & 27 deletions .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,7 @@ on:
jobs:
promote:
name: Promote Charm
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set target channel
env:
PROMOTE_FROM: ${{ github.event.inputs.promotion }}
run: |
if [ "${PROMOTE_FROM}" == "edge -> beta" ]; then
echo "promote-from=edge" >> ${GITHUB_ENV}
echo "promote-to=beta" >> ${GITHUB_ENV}
elif [ "${PROMOTE_FROM}" == "beta -> candidate" ]; then
echo "promote-from=beta" >> ${GITHUB_ENV}
echo "promote-to=candidate" >> ${GITHUB_ENV}
elif [ "${PROMOTE_FROM}" == "candidate -> stable" ]; then
echo "promote-from=candidate" >> ${GITHUB_ENV}
echo "promote-to=stable" >> ${GITHUB_ENV}
fi
- name: Promote Charm
uses: canonical/charming-actions/release-charm@2.3.0
with:
base-channel: 22.04
credentials: ${{ secrets.CHARMCRAFT_AUTH }}
github-token: ${{ secrets.GITHUB_TOKEN }}
destination-channel: latest/${{ env.promote-to }}
origin-channel: latest/${{ env.promote-from }}
charmcraft-channel: latest/stable
uses: canonical/sdcore-github-workflows/.github/workflows/promote.yaml@main
with:
promotion: ${{ github.event.inputs.promotion }}
secrets: inherit
32 changes: 0 additions & 32 deletions .github/workflows/publish-charm.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/static-analysis.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/unit-test.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.idea
.vscode/
.coverage
.mypy_cache/
.tox/

# Python
**/venv/**
*.pyc

# Charmcraft
*.charm

0 comments on commit 16e35fd

Please sign in to comment.