Skip to content

Commit 26bc95b

Browse files
committed
Create Composite Action for integration testing
1 parent 8a02b67 commit 26bc95b

File tree

3 files changed

+57
-58
lines changed

3 files changed

+57
-58
lines changed

.github/workflows/build-golang-macos.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ jobs:
102102
# Test wheel functionality
103103
# python3 validate_otdf_python.py
104104
105+
- uses: ./.github/workflows/platform-integration-test.yaml
106+
with:
107+
wheel: dist/otdf_python-0.0.15-py3-none-any.whl
108+
105109
# release:
106110
# needs: build
107111
# runs-on: macos-latest

.github/workflows/build-golang-ubuntu.yaml

Lines changed: 18 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -75,55 +75,12 @@ jobs:
7575
7676
poetry run python3 setup.py bdist_wheel
7777
78-
# TODO: Can this be a distinct job?
79-
# exercise-ssh:
80-
# needs: build
81-
82-
# runs-on: ubuntu-latest
83-
84-
# steps:
85-
# - uses: actions/checkout@v4
8678
8779
- name: Check existing workspace content
8880
run: |
8981
ls -la
9082
ls -la dist/
9183
92-
# - name: Set up Docker Buildx
93-
# uses: docker/setup-buildx-action@v3
94-
95-
# - name: Install Vagrant
96-
# run: sudo apt-get update && sudo apt-get install -y vagrant
97-
98-
# - name: Create Vagrantfile
99-
# run: |
100-
# cat << EOF > Vagrantfile
101-
# Vagrant.configure("2") do |config|
102-
# config.vm.provider "docker" do |d|
103-
# d.image = "ubuntu"
104-
# d.cmd = [ "/bin/bash", "-c", "echo 'Hello world'" ]
105-
# d.remains_running = false
106-
# end
107-
# end
108-
# EOF
109-
110-
# - name: Run vagrant up
111-
# run: vagrant up --provider=docker
112-
113-
# - name: Launch the Docker/Vagrant test machine
114-
# run: |
115-
# # Change directory
116-
# cd ssh-servers/docker-in-vagrant
117-
118-
# # List content in the directory
119-
# ls -la
120-
121-
# # Launch machine
122-
# vagrant up --provider=docker
123-
124-
# # Connect to it with SSH
125-
# vagrant ssh -c "echo 'Hello Ubuntu'"
126-
12784
- name: Test Python wheel
12885
run: |
12986
# Test wheel installation
@@ -132,3 +89,21 @@ jobs:
13289
# DISABLED: Need to figure out Ubuntu nested VM
13390
# Test wheel functionality
13491
# python3 validate_otdf_python.py
92+
93+
- uses: actions/cache/restore@v4
94+
with:
95+
path: dist/otdf_python-0.0.15-py3-none-any.whl
96+
key: ${{ runner.os }}-data-${{ github.sha }}
97+
98+
- uses: actions/cache/save@v4
99+
with:
100+
path: dist/otdf_python-0.0.15-py3-none-any.whl
101+
key: ${{ runner.os }}-data-${{ github.sha }}
102+
restore-keys: |
103+
${{ runner.os }}-data-
104+
105+
integration-test:
106+
needs: build
107+
uses: ./.github/workflows/platform-integration-test.yaml
108+
with:
109+
wheel: dist/otdf_python-0.0.15-py3-none-any.whl

.github/workflows/platform-integration-test.yaml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11
# Based on
22
# https://github.com/opentdf/java-sdk/blob/v0.6.1/.github/workflows/checks.yaml
3+
#
4+
# Except, that this is a "Composite Action", and specifies 'shell: bash' for
5+
# each 'run:' step.
36
name: "Platform Integration testing"
47

58
on:
6-
pull_request:
7-
8-
# on:
9-
# pull_request:
10-
# branches:
11-
# - main
12-
# push:
13-
# branches:
14-
# - main
9+
workflow_call:
10+
inputs:
11+
wheel:
12+
description: The Python wheel to test
13+
required: true
14+
type: string
1515

1616
permissions:
1717
contents: read
1818

1919
jobs:
20-
21-
platform-integration:
22-
runs-on: ubuntu-22.04
20+
integration_test:
21+
runs-on: ubuntu-latest
2322
steps:
24-
- name: Checkout Java SDK
23+
- name: Checkout this repo
2524
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
26-
- uses: bufbuild/buf-setup-action@382440cdb8ec7bc25a68d7b4711163d95f7cc3aa
25+
26+
- uses: actions/cache/restore@v4
2727
with:
28-
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
path: dist/otdf_python-0.0.15-py3-none-any.whl
29+
key: ${{ runner.os }}-data-${{ github.sha }}
30+
31+
- name: Prove that the input file is available
32+
shell: bash
33+
run: |
34+
ls -la
35+
ls -la "${{ inputs.wheel }}"
36+
du -sh "${{ inputs.wheel }}"
37+
38+
# - uses: bufbuild/buf-setup-action@382440cdb8ec7bc25a68d7b4711163d95f7cc3aa
39+
# with:
40+
# github_token: ${{ secrets.GITHUB_TOKEN }}
2941

3042
- name: Check out platform
3143
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
@@ -44,10 +56,13 @@ jobs:
4456
platform/protocol/go/go.sum
4557
platform/sdk/go.sum
4658
- run: go mod download
59+
shell: bash
4760
working-directory: platform
4861
- run: go mod verify
62+
shell: bash
4963
working-directory: platform
5064
- name: Create keys
65+
shell: bash
5166
run: |
5267
.github/scripts/init-temp-keys.sh
5368
cp opentdf-dev.yaml opentdf.yaml
@@ -64,12 +79,15 @@ jobs:
6479
# -alias localhost-for-tests
6580
# working-directory: platform/keys
6681
- name: Bring the services up
82+
shell: bash
6783
run: docker compose up -d --wait --wait-timeout 240
6884
working-directory: platform
6985
- name: Provision keycloak
86+
shell: bash
7087
run: go run ./service provision keycloak
7188
working-directory: platform
7289
- name: Provision fixtures
90+
shell: bash
7391
run: go run ./service provision fixtures
7492
working-directory: platform
7593
- name: Start server in background
@@ -83,8 +101,10 @@ jobs:
83101
wait-for: 90s
84102
working-directory: platform
85103
- name: Get grpcurl
104+
shell: bash
86105
run: go install github.com/fullstorydev/grpcurl/cmd/[email protected]
87106
- name: Make sure that the platform is up
107+
shell: bash
88108
run: |
89109
grpcurl -plaintext localhost:8080 list && \
90110
grpcurl -plaintext localhost:8080 kas.AccessService/PublicKey

0 commit comments

Comments
 (0)