1+ ---
12name : ci
23
34on :
@@ -15,133 +16,116 @@ 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"
21+ TOPAZ_VERSION : " 0.32.38"
1922
2023jobs :
2124 test :
2225 name : Run test
2326 runs-on : ubuntu-latest
2427 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
28+ -
29+ name : Checkout Repo
4230 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
31+ -
32+ name : Install topaz CLI
33+ env :
34+ GH_TOKEN : ${{ github.token }}
35+ run : |
36+ gh release download v${{ env.TOPAZ_VERSION }} --repo aserto-dev/topaz --pattern "topaz_linux_x86_64.zip" \
37+ --output ./ext/topaz.zip --clobber
38+ unzip ./ext/topaz.zip -d bin
39+ chmod +x ./bin/topaz
40+ ./bin/topaz version
41+ echo "TOPAZ=$(realpath ./bin/topaz)" >> "$GITHUB_ENV"
42+ echo "TOPAZ_CERTS_DIR=$(./bin/topaz config info | jq '.config.topaz_certs_dir' -r)" >> "$GITHUB_ENV"
43+ -
44+ name : Install topazd container
45+ run : |
46+ ${TOPAZ} install --container-tag=${{ env.TOPAZ_VERSION }}
47+ ${TOPAZ} version
48+ -
49+ name : Generate topaz certs
50+ run : ${TOPAZ} certs generate
51+ -
52+ name : Setup python
5153 uses : actions/setup-python@v5
5254 with :
53- python-version : ' 3.12 '
54-
55- - name : Install and configure Poetry
55+ python-version : ${{ env.PYTHON_VERSION }}
56+ -
57+ name : Install and configure Poetry
5658 uses : snok/install-poetry@v1
5759 with :
58- version : 1.8.3
60+ version : ${{ env.POETRY_VERSION }}
61+ -
62+ name : Install dependencies
63+ run : poetry install
64+ -
65+ name : Lint
66+ run : poetry run pyright .
67+ -
68+ name : Test
69+ run : poetry run pytest -vv
5970
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
6871 release :
6972 runs-on : ubuntu-latest
7073 needs : test
7174 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
7275
7376 name : Release to pypi
7477 steps :
75- - name : Read Configuration
78+ -
79+ uses : actions/create-github-app-token@v1
80+ id : app-token
81+ with :
82+ app-id : ${{ vars.CODEGEN_APP_ID }}
83+ private-key : ${{ secrets.CODEGEN_APP_KEY }}
84+ -
85+ name : Checkout
86+ uses : actions/checkout@v4
87+ with :
88+ fetch-depth : 0
89+ token : ${{ steps.app-token.outputs.token }}
90+ -
91+ name : Read Configuration
7692 uses : hashicorp/vault-action@v3
7793 id : vault
7894 with :
7995 url : ${{ env.VAULT_ADDR }}
8096 token : ${{ secrets.VAULT_TOKEN }}
8197 secrets : |
82- kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
8398 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
99+ -
100+ name : Set up Python
122101 uses : actions/setup-python@v5
123102 with :
124- python-version : ' 3.12 '
125-
126- - name : Install Poetry
103+ python-version : ${{ env.PYTHON_VERSION }}
104+ -
105+ name : Install Poetry
127106 uses : snok/install-poetry@v1
128107 with :
129- version : 1.8.3
130-
131- - name : Build and push the python package
108+ version : ${{ env.POETRY_VERSION }}
109+ -
110+ name : Build
111+ run : poetry build
112+ -
113+ name : Publish
132114 env :
133115 # When using a PYPI API token, the user name must be set to "__token__"
134116 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
117+ run : |
118+ poetry publish
119+ -
120+ name : Bump version
121+ id : bump
122+ uses : callowayproject/bump-my-version@master
123+ with :
124+ args : patch
125+ -
126+ name : Commit changes
141127 uses : EndBug/add-and-commit@v9
142128 with :
143129 default_author : github_actions
144- message : ' Bump to next version'
130+ message : ' Bump version: ${{ steps.bump.outputs.current- version }} '
145131 add : ' pyproject.toml'
146- push : origin HEAD:main
147-
0 commit comments