diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..18dda757 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,98 @@ +name: Go + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Cache libraries + uses: actions/cache@v2 + env: + cache-name: cache-go + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - name: Env + run: go env + - name: Build + run: make build build-test-tools + - name: Test + run: make check pristine test + + - name: Prepare tar to upload built binaries + run: tar -cvf built-binaries.tar helmfile diff-yamls yamldiff + - name: Upload built binaries + uses: actions/upload-artifact@v2 + with: + name: built-binaries-${{ github.run_id }} + path: built-binaries.tar + retention-days: 1 + - name: Display built binaries + run: ls -l helmfile diff-yamls yamldiff + + integration_tests: + needs: tests + runs-on: ubuntu-latest + strategy: + matrix: + include: + - helm-version: v3.4.2 + - helm-version: v3.5.4 + - helm-version: v3.6.3 + - helm-version: v3.7.2 + - helm-version: v3.8.0 + steps: + - uses: actions/checkout@v2 + - name: Cache libraries + uses: actions/cache@v2 + env: + cache-name: cache-go + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - name: Env + run: go env + + - name: Download built binaries + uses: actions/download-artifact@v2 + with: + name: built-binaries-${{ github.run_id }} + - name: Extract tar to get built binaries + run: tar -xvf built-binaries.tar + - name: Display built binaries + run: ls -l helmfile diff-yamls yamldiff + + - name: Install test dependencies + env: + HELM_VERSION: ${{ matrix.helm-version }} + run: make -C .circleci helm vault sops kustomize + - name: Start minikube + uses: medyagh/setup-minikube@master + - name: Execute integration tests + env: + HELMFILE_HELM3: 1 + TERM: xterm + run: make integration