Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 78 additions & 93 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: ci

on:
Expand All @@ -15,133 +16,117 @@ on:

env:
VAULT_ADDR: https://vault.eng.aserto.com/
GO_VERSION: "1.22"
PYTHON_VERSION: "3.9"
POETRY_VERSION: "1.8.3"
TOPAZ_VERSION: "0.32.38"

jobs:
test:
name: Run test
runs-on: ubuntu-latest
steps:
- name: Read Configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;

- name: Setup git
run: |
mkdir -p $HOME/.ssh
umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
ssh-keyscan github.com >> $HOME/.ssh/known_hosts
git config --global url."git@github.com:".insteadOf https://github.com/

- name: Checkout Repo
-
name: Checkout Repo
uses: actions/checkout@v4

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Install topaz
run: brew tap aserto-dev/tap && brew install aserto-dev/tap/topaz && topaz install

- name: Use python 3.9
-
name: Install topaz CLI
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download v${{ env.TOPAZ_VERSION }} --repo aserto-dev/topaz --pattern "topaz_linux_x86_64.zip" \
--output ./ext/topaz.zip --clobber
unzip ./ext/topaz.zip -d bin
chmod +x ./bin/topaz
./bin/topaz version
echo "TOPAZ=$(realpath ./bin/topaz)" >> "$GITHUB_ENV"
echo "TOPAZ_CERTS_DIR=$(./bin/topaz config info | jq '.config.topaz_certs_dir' -r)" >> "$GITHUB_ENV"
echo "PATH=$PATH:$(realpath ./bin)" >> "$GITHUB_ENV"
-
name: Install topazd container
run: |
topaz install --container-tag=${{ env.TOPAZ_VERSION }}
topaz version
-
name: Generate topaz certs
run: topaz certs generate
-
name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install and configure Poetry
python-version: ${{ env.PYTHON_VERSION }}
-
name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
version: ${{ env.POETRY_VERSION }}
-
name: Install dependencies
run: poetry install
-
name: Lint
run: poetry run pyright .
-
name: Test
run: poetry run pytest -vv

- name: Run lint
run: |
poetry install
poetry run pyright .

- name: Run tests
run: |
poetry run pytest -vv
release:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

name: Release to pypi
steps:
- name: Read Configuration
-
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
private-key: ${{ secrets.CODEGEN_APP_KEY }}
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
-
name: Read Configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
kv/data/pypi "API_TOKEN" | POETRY_HTTP_BASIC_PYPI_PASSWORD;

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Setup caching
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
.ext
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum', 'Depfile') }}
restore-keys: |
${{ runner.os }}-go-

- name: Install dependencies
run: |
mkdir -p $HOME/.ssh
umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
ssh-keyscan github.com >> $HOME/.ssh/known_hosts

git config --global url."git@github.com:".insteadOf https://github.com/
git config --global user.email "github-bot@aserto.com"
git config --global user.name "Aserto Bot"

eval `ssh-agent`
ssh-add $HOME/.ssh/id_rsa

go run mage.go deps

- name: Set up Python
-
name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Poetry
python-version: ${{ env.PYTHON_VERSION }}
-
name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3

- name: Build and push the python package
version: ${{ env.POETRY_VERSION }}
-
name: Build
run: poetry build
-
name: Publish
env:
# When using a PYPI API token, the user name must be set to "__token__"
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
run: go run mage.go release

- name: Bump to the next version
run: go run mage.go bump patch

- name: Commit changes
run: |
poetry publish
-
name: Bump version
id: bump
uses: callowayproject/bump-my-version@master
with:
args: patch
-
name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Bump to next version'
message: 'Bump version: ${{ steps.bump.outputs.current-version }}'
add: 'pyproject.toml'
push: origin HEAD:main

5 changes: 0 additions & 5 deletions Depfile

This file was deleted.

12 changes: 0 additions & 12 deletions mage.go

This file was deleted.

58 changes: 0 additions & 58 deletions magefiles/go.mod

This file was deleted.

Loading
Loading