-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: ci | ||
|
||
on: | ||
|
@@ -15,133 +16,115 @@ on: | |
|
||
env: | ||
VAULT_ADDR: https://vault.eng.aserto.com/ | ||
GO_VERSION: "1.22" | ||
PYTHON_VERSION: "3.9" | ||
POETRY_VERSION: "1.8.3" | ||
|
||
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."[email protected]:".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" | ||
- | ||
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."[email protected]:".insteadOf https://github.com/ | ||
git config --global user.email "[email protected]" | ||
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 | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.