1+ ---
12name : ci
23
34on :
@@ -15,133 +16,115 @@ on:
1516
1617env :
1718 VAULT_ADDR : https://vault.eng.aserto.com/
18- GO_VERSION : " 1.22"
19+ PYTHON_VERSION : " 3.9"
20+ POETRY_VERSION : " 1.8.3"
1921
2022jobs :
2123 test :
2224 name : Run test
2325 runs-on : ubuntu-latest
2426 steps :
25- - name : Read Configuration
26- uses : hashicorp/vault-action@v3
27- id : vault
28- with :
29- url : ${{ env.VAULT_ADDR }}
30- token : ${{ secrets.VAULT_TOKEN }}
31- secrets : |
32- kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
33-
34- - name : Setup git
35- run : |
36- mkdir -p $HOME/.ssh
37- umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
38- ssh-keyscan github.com >> $HOME/.ssh/known_hosts
39- git config --global url."[email protected] :".insteadOf https://github.com/ 40-
41- - name : Checkout Repo
27+ -
28+ name : Checkout Repo
4229 uses : actions/checkout@v4
43-
44- - name : Set up Homebrew
45- uses : Homebrew/actions/setup-homebrew@master
46-
47- - name : Install topaz
48- run : brew tap aserto-dev/tap && brew install aserto-dev/tap/topaz && topaz install
49-
50- - name : Use python 3.9
30+ -
31+ name : Install topaz CLI
32+ env :
33+ GH_TOKEN : ${{ github.token }}
34+ run : |
35+ gh release download v${{ env.TOPAZ_VERSION }} --repo aserto-dev/topaz --pattern "topaz_linux_x86_64.zip" \
36+ --output ./ext/topaz.zip --clobber
37+ unzip ./ext/topaz.zip -d bin
38+ chmod +x ./bin/topaz
39+ ./bin/topaz version
40+ echo "TOPAZ=$(realpath ./bin/topaz)" >> "$GITHUB_ENV"
41+ echo "TOPAZ_CERTS_DIR=$(./bin/topaz config info | jq '.config.topaz_certs_dir' -r)" >> "$GITHUB_ENV"
42+ -
43+ name : Install topazd container
44+ run : |
45+ ${TOPAZ} install --container-tag=${{ env.TOPAZ_VERSION }}
46+ ${TOPAZ} version
47+ -
48+ name : Generate topaz certs
49+ run : ${TOPAZ} certs generate
50+ -
51+ name : Setup python
5152 uses : actions/setup-python@v5
5253 with :
53- python-version : ' 3.12 '
54-
55- - name : Install and configure Poetry
54+ python-version : ${{ env.PYTHON_VERSION }}
55+ -
56+ name : Install and configure Poetry
5657 uses : snok/install-poetry@v1
5758 with :
58- version : 1.8.3
59+ version : ${{ env.POETRY_VERSION }}
60+ -
61+ name : Install dependencies
62+ run : poetry install
63+ -
64+ name : Lint
65+ run : poetry run pyright .
66+ -
67+ name : Test
68+ run : poetry run pytest -vv
5969
60- - name : Run lint
61- run : |
62- poetry install
63- poetry run pyright .
64-
65- - name : Run tests
66- run : |
67- poetry run pytest -vv
6870 release :
6971 runs-on : ubuntu-latest
7072 needs : test
7173 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
7274
7375 name : Release to pypi
7476 steps :
75- - name : Read Configuration
77+ -
78+ uses : actions/create-github-app-token@v1
79+ id : app-token
80+ with :
81+ app-id : ${{ vars.CODEGEN_APP_ID }}
82+ private-key : ${{ secrets.CODEGEN_APP_KEY }}
83+ -
84+ name : Checkout
85+ uses : actions/checkout@v4
86+ with :
87+ fetch-depth : 0
88+ token : ${{ steps.app-token.outputs.token }}
89+ -
90+ name : Read Configuration
7691 uses : hashicorp/vault-action@v3
7792 id : vault
7893 with :
7994 url : ${{ env.VAULT_ADDR }}
8095 token : ${{ secrets.VAULT_TOKEN }}
8196 secrets : |
82- kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
8397 kv/data/pypi "API_TOKEN" | POETRY_HTTP_BASIC_PYPI_PASSWORD;
84-
85- - name : Checkout
86- uses : actions/checkout@v4
87- with :
88- fetch-depth : 0
89-
90- - name : Setup Go
91- uses : actions/setup-go@v5
92- with :
93- go-version : ${{ env.GO_VERSION }}
94-
95- - name : Setup caching
96- uses : actions/cache@v4
97- with :
98- path : |
99- ~/.cache/go-build
100- ~/go/pkg/mod
101- .ext
102- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum', 'Depfile') }}
103- restore-keys : |
104- ${{ runner.os }}-go-
105-
106- - name : Install dependencies
107- run : |
108- mkdir -p $HOME/.ssh
109- umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
110- ssh-keyscan github.com >> $HOME/.ssh/known_hosts
111-
112- git config --global url."[email protected] :".insteadOf https://github.com/ 113- git config --global user.email "[email protected] " 114- git config --global user.name "Aserto Bot"
115-
116- eval `ssh-agent`
117- ssh-add $HOME/.ssh/id_rsa
118-
119- go run mage.go deps
120-
121- - name : Set up Python
98+ -
99+ name : Set up Python
122100 uses : actions/setup-python@v5
123101 with :
124- python-version : ' 3.12 '
125-
126- - name : Install Poetry
102+ python-version : ${{ env.PYTHON_VERSION }}
103+ -
104+ name : Install Poetry
127105 uses : snok/install-poetry@v1
128106 with :
129- version : 1.8.3
130-
131- - name : Build and push the python package
107+ version : ${{ env.POETRY_VERSION }}
108+ -
109+ name : Build
110+ run : poetry build
111+ -
112+ name : Publish
132113 env :
133114 # When using a PYPI API token, the user name must be set to "__token__"
134115 POETRY_HTTP_BASIC_PYPI_USERNAME : __token__
135- run : go run mage.go release
136-
137- - name : Bump to the next version
138- run : go run mage.go bump patch
139-
140- - name : Commit changes
116+ run : |
117+ poetry publish
118+ -
119+ name : Bump version
120+ id : bump
121+ uses : callowayproject/bump-my-version@master
122+ with :
123+ args : patch
124+ -
125+ name : Commit changes
141126 uses : EndBug/add-and-commit@v9
142127 with :
143128 default_author : github_actions
144- message : ' Bump to next version'
129+ message : ' Bump version: ${{ steps.bump.outputs.current- version }} '
145130 add : ' pyproject.toml'
146- push : origin HEAD:main
147-
0 commit comments