This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2940 from fluxcd/ci-github-actions
ci: Migrate tests to GitHub actions
- Loading branch information
Showing
7 changed files
with
148 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: artifacts-cleanup | ||
|
||
on: | ||
schedule: | ||
# Every day at 1am | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
remove-old-artifacts: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Remove old artifacts | ||
uses: c-hive/gha-remove-artifacts@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
age: '1 day' | ||
skip-tags: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit-testing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: niden/actions-memcached@v7 | ||
- name: Restore Go cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Setup Go | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: 1.14.x | ||
- name: Run tests | ||
run: make test TEST_FLAGS="-race -tags integration -timeout 5m" | ||
- name: Check codegen | ||
run: make check-generated | ||
- name: Build binaries | ||
run: make all | ||
- name: Prepare cache | ||
run: | | ||
cp "$(go env GOPATH)/bin/fluxctl" cache/fluxctl | ||
docker save -o cache/flux-latest.tar fluxcd/flux:latest | ||
- name: Upload cache | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: cache | ||
path: cache | ||
e2e-testing: | ||
runs-on: ubuntu-latest | ||
needs: unit-testing | ||
strategy: | ||
matrix: | ||
test: ['10_* 11_* 12_*', '13_* 14_*', '15_* 16_* 17_*', '20_* 21_* 22_*'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: engineerd/[email protected] | ||
- name: Restore Go cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Setup Go | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: 1.14.x | ||
- name: Download cache | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: cache | ||
- name: Load cache | ||
run: | | ||
chmod +x cache/fluxctl | ||
sudo mv cache/fluxctl /usr/local/bin/fluxctl | ||
docker load --input cache/flux-latest.tar -q | ||
kind load docker-image fluxcd/flux:latest | ||
- name: Run tests | ||
run: | | ||
E2E_TESTS='${{ matrix.test }}' make e2e-gh |
12 changes: 9 additions & 3 deletions
12
.github/workflows/check-links.yaml → .github/workflows/docs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
|
||
# This script runs the bats tests | ||
|
||
# Directory paths we need to be aware of | ||
FLUX_ROOT_DIR="$(git rev-parse --show-toplevel)" | ||
E2E_DIR="${FLUX_ROOT_DIR}/test/e2e" | ||
CACHE_DIR="${FLUX_ROOT_DIR}/cache/$CURRENT_OS_ARCH" | ||
|
||
KIND_VERSION=v0.7.0 | ||
KUBE_VERSION=v1.14.10 | ||
GITSRV_VERSION=v1.0.0 | ||
KIND_CACHE_PATH="${CACHE_DIR}/kind-$KIND_VERSION" | ||
KIND_CLUSTER_PREFIX=flux-e2e | ||
BATS_EXTRA_ARGS="" | ||
|
||
# shellcheck disable=SC1090 | ||
source "${E2E_DIR}/lib/defer.bash" | ||
trap run_deferred EXIT | ||
|
||
mkdir -p "${FLUX_ROOT_DIR}/cache" | ||
curl -sL "https://github.com/fluxcd/gitsrv/releases/download/${GITSRV_VERSION}/known_hosts.txt" > "${FLUX_ROOT_DIR}/cache/known_hosts" | ||
|
||
echo '>>> Running the tests' | ||
# Run all tests by default but let users specify which ones to run, e.g. with E2E_TESTS='11_*' make e2e | ||
E2E_TESTS=${E2E_TESTS:-.} | ||
( | ||
cd "${E2E_DIR}" | ||
# shellcheck disable=SC2086 | ||
"${E2E_DIR}/bats/bin/bats" -t ${BATS_EXTRA_ARGS} ${E2E_TESTS} | ||
) |