Clean up GitHub Action definitions

This defines a local action for the common actions performed by most of
our workflows. This reduces duplication between them to make sure they
are consistent, and also make the workflow definitions more concise to
just the operations that are unique to the particular testing
activities.

Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis
2024-06-11 19:58:54 +00:00
parent dda3e5b847
commit f5c16ab072
5 changed files with 38 additions and 80 deletions

34
.github/actions/setup-env/action.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: "Setup environment"
description: "Performs common setup operations."
runs:
using: "composite"
steps:
- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true
- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin
shell: bash
- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
shell: bash
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
shell: bash

View File

@@ -28,31 +28,7 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true
- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin
- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
- uses: ./.github/actions/setup-env
- name: Create single node cluster
if: ${{ matrix.deployment == 'singleNode' }}

View File

@@ -31,34 +31,8 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true
- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin
- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
- uses: ./.github/actions/setup-env
- name: Install nerdctl
run: |

View File

@@ -31,34 +31,8 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Get go version
id: golangversion
run: |
echo "go_version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.golangversion.outputs.go_version }}
check-latest: true
- name: Install kind
run: sudo make install INSTALL_DIR=/usr/local/bin
- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
- uses: ./.github/actions/setup-env
- name: Setup podman
run: |

View File

@@ -14,7 +14,7 @@ permissions:
jobs:
vm:
# Fedora is different from Ubuntu in LSM (SELinux), filesystem (btrfs), kernel version, etc.
name: "VM (Fedora)"
name: "CGroupv2 (Fedora)"
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy: