name: Source Plugin Test Workflow concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: pull_request: paths: - "plugins/source/test/**" - ".github/workflows/source_test.yml" push: branches: - main paths: - "plugins/source/test/**" - ".github/workflows/source_test.yml" permissions: contents: read jobs: plugins-source-test: timeout-minutes: 30 name: "plugins/source/test" runs-on: ubuntu-latest defaults: run: working-directory: ./plugins/source/test steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 2 - name: Set up Go 1.x id: setup-go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: plugins/source/test/go.mod cache: false - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: | ~/.cache/go-build ~/go/pkg/mod key: ${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-test-source-test-${{ hashFiles('plugins/source/test/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-test-source-test- - name: golangci-lint uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9 with: version: v2.11.4 working-directory: plugins/source/test args: "--config ../../.golangci.yml" - name: Setup CloudQuery if: github.event_name == 'pull_request' uses: cloudquery/setup-cloudquery@b7f7ea62cfec9774ad44a0d9307d0f6c5573bcb6 # v5.0.2 with: version: v6.35.7 - name: gen if: github.event_name == 'pull_request' run: make gen - name: Fail if generation updated files if: github.event_name == 'pull_request' run: test "$(git status -s | wc -l)" -eq 0 || (git status -s; exit 1) - name: Build run: go build . - name: Test run: make test validate-fips: timeout-minutes: 30 runs-on: ubuntu-latest defaults: run: working-directory: ./plugins/source/test steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go 1.x id: setup-go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: plugins/source/test/go.mod cache: false - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: | ~/.cache/go-build ~/go/pkg/mod key: ${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-validate-plugin-fips-cache-source-test-${{ hashFiles('plugins/source/test/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-validate-plugin-fips-cache-source-test- - name: Run package command env: GOFLAGS: "-tags=fipsEnabled" run: | rm -rf docs/tables.md go run main_fips.go package -m "chore: Test FIPS" "v1.0.0" . - name: Unzip package artifacts run: | unzip -o dist/plugin-test-v1.0.0-linux-amd64.zip chmod +x plugin-test-v1.0.0-linux-amd64 ./plugin-test-v1.0.0-linux-amd64 --version 2>&1 | grep -E 'FIPS enabled: true'