Skip to content

Commit

Permalink
feat(gh-actions): add action for running tests (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Velikonja authored Jan 18, 2023
1 parent f886ee0 commit 4fca702
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
50 changes: 49 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Tests

on:
push:
Expand Down Expand Up @@ -26,3 +26,51 @@ jobs:
with:
version: latest
args: --timeout 3m

tests:
runs-on: ubuntu-latest

strategy:
matrix:
vaultVer: [ "1.12.2", "1.11.6" ]

services:
vault:
image: vault:${{ matrix.vaultVer }}
ports:
- 8200:8200
options: >-
--cap-add IPC_LOCK
env:
VAULT_DEV_ROOT_TOKEN_ID: testtoken
VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
VAULT_LOG_LEVEL: trace

steps:
- id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.x"

- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: Run tests
run: make test
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# k8s-vault-operator

![Tests](https://github.com/kiwicom/k8s-vault-operator/actions/workflows/main.yml/badge.svg)

Syncing vault secrets to k8s secrets.

## Description
Expand Down Expand Up @@ -580,4 +583,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ services:
- IPC_LOCK
ports:
- "8200:8200"
command: server -dev --log-level=trace -dev-listen-address=0.0.0.0:8200
environment:
VAULT_DEV_ROOT_TOKEN_ID: testtoken
VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
VAULT_LOG_LEVEL: trace

runner:
image: golang:alpine
Expand All @@ -21,4 +22,3 @@ services:
VAULT_TOKEN: testtoken
volumes:
- .:/app

0 comments on commit 4fca702

Please sign in to comment.