chore: optimize docker layers #1002
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
name: Continuous Integration | |
on: | |
workflow_dispatch: null | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
paths: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Harden Runner | |
uses: step-security/harden-runner@v2 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
base: ${{ github.ref }} | |
filters: .github/filters.yml | |
ci: | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }} | |
steps: | |
- name: Install cryptsetup | |
run: | | |
sudo apt install libcryptsetup12 libcryptsetup-dev | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: go vet ./... | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
- run: make build | |
- run: go test -cover ./... -coverprofile ./coverage.out | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
files: ./coverage.out | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: linode/linode-blockstorage-csi-driver | |
e2e-tests: | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }} | |
IMAGE_VERSION: ${{ github.ref == 'refs/heads/main' && 'latest' || format('pr-{0}', github.event.number) || github.ref_name }} | |
LINODE_REGION: us-lax | |
LINODE_CONTROL_PLANE_MACHINE_TYPE: g6-standard-2 | |
LINODE_MACHINE_TYPE: g6-standard-2 | |
WORKER_NODES: ${{ github.ref == 'refs/heads/main' && '3' || '1' }} | |
steps: | |
- name: Install cryptsetup | |
run: | | |
sudo apt install libcryptsetup12 libcryptsetup-dev | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Install devbox | |
uses: jetify-com/[email protected] | |
- name: Setup CAPL Management Kind Cluster and CAPL Child Cluster For Testing | |
run: devbox run mgmt-and-capl-cluster | |
- name: Run E2E Tests | |
run: devbox run e2e-test | |
- name: Run CSI-Sanity Tests | |
run: devbox run csi-sanity-test | |
- name: run upstream E2E Tests | |
if: github.ref == 'refs/heads/main' | |
run: devbox run upstream-e2e-tests | |
- name: Cleanup Resources | |
if: always() | |
run: devbox run cleanup-cluster |