Skip to content

CI

CI #1174

Workflow file for this run

# 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: "CI"
permissions:
id-token: write
contents: read
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
location:
description: The region to deploy ACIs to
type: string
policy_type:
description: The policy type to use
type: string
workflow_call:
inputs:
location:
description: The region to deploy ACIs to
type: string
policy_type:
description: The policy type to use
type: string
env:
BASE_ID: ${{ github.run_id }}-${{ github.run_number }}-${{ inputs.location }}-${{ inputs.policy_type }}
LOCATION: ${{ inputs.location || 'westeurope' }}
POLICY_TYPE: ${{ inputs.policy_type || 'generated' }}
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'go' ]
# 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@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
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 Jav).
# 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"
bash ./buildall.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
- name: Aqua Security Trivy
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
severity: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
build:
name: Go Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Sets up the Golang for running unit tests
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23.x"
- name: Go Build
run: go build -v ./...
- name: Go Tests
run: |
# Can't use `go test -v ./...` because some of the tests depend on SEV-SNP or Confidential ACI features
go test -v ./... -tags skip_e2e,skip_snp_required
test-attestation:
name: Test Attestation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log into Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.MANAGED_ID_CLIENT_ID }}
tenant-id: ${{ secrets.MANAGED_ID_TENANT_ID }}
subscription-id: ${{ vars.SUBSCRIPTION }}
- name: Install c_aci_testing package
env:
GH_TOKEN: ${{ github.token }}
run: ./scripts/install-c-aci-testing.sh
- name: Install Azure CLI
env:
AZ_CLI_VERSION: 2.61.0
run: ./scripts/install-az-cli.sh
- name: Setup Docker
run: sudo usermod -aG docker $USER
- name: Test Attestation
env:
ATTESTATION_ENDPOINT: ${{ vars.ATTESTATION_ENDPOINT }}
run: |
source cacitesting.env
export LOCATION=${{ env.LOCATION }}
python -m unittest discover -s tests/attestation
test-skr:
name: Test SKR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install c_aci_testing package
env:
GH_TOKEN: ${{ github.token }}
run: ./scripts/install-c-aci-testing.sh
- name: Install Azure CLI
env:
AZ_CLI_VERSION: 2.61.0
run: ./scripts/install-az-cli.sh
- name: Setup Docker
run: sudo usermod -aG docker $USER
- name: Log into Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.MANAGED_ID_CLIENT_ID }}
tenant-id: ${{ secrets.MANAGED_ID_TENANT_ID }}
subscription-id: ${{ vars.SUBSCRIPTION }}
# Deployment is separated from testing to avoid the AZ CLI login timeout
- name: Deploy the SKR container group
env:
ID: skr-${{ env.BASE_ID }}
TAG: ${{ env.BASE_ID }}
run: |
source cacitesting.env
export LOCATION=${{ env.LOCATION }}
c-aci-testing target run tests/skr \
--deployment-name $ID \
--no-cleanup
- name: Re-Log into Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.MANAGED_ID_CLIENT_ID }}
tenant-id: ${{ secrets.MANAGED_ID_TENANT_ID }}
subscription-id: ${{ vars.SUBSCRIPTION }}
- name: Test SKR
env:
ID: skr-${{ env.BASE_ID }}
TAG: ${{ env.BASE_ID }}
ATTESTATION_ENDPOINT: ${{ vars.ATTESTATION_ENDPOINT }}
HSM_ENDPOINT: ${{ vars.HSM_ENDPOINT }}
run: |
source cacitesting.env
export LOCATION=${{ env.LOCATION }}
python -m unittest discover -s tests/skr
test-encfs:
name: Test EncFS
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install c_aci_testing package
env:
GH_TOKEN: ${{ github.token }}
run: ./scripts/install-c-aci-testing.sh
- name: Install Azure CLI
env:
AZ_CLI_VERSION: 2.61.0
run: ./scripts/install-az-cli.sh
- name: Setup Docker
run: sudo usermod -aG docker $USER
- name: Log into Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.MANAGED_ID_CLIENT_ID }}
tenant-id: ${{ secrets.MANAGED_ID_TENANT_ID }}
subscription-id: ${{ vars.SUBSCRIPTION }}
- name: Test ENCFS
env:
ID: encfs-${{ env.BASE_ID }}
TAG: ${{ env.BASE_ID }}
ATTESTATION_ENDPOINT: ${{ vars.ATTESTATION_ENDPOINT }}
HSM_ENDPOINT: ${{ vars.HSM_ENDPOINT }}
STORAGE_ACCOUNT_NAME: ${{ vars.STORAGE_ACCOUNT_NAME }}
STORAGE_CONTAINER_NAME: ${{ vars.STORAGE_CONTAINER_NAME }}
run: |
source cacitesting.env
export LOCATION=${{ env.LOCATION }}
python -m unittest discover -s tests/encfs