Skip to content

Commit

Permalink
[StepSecurity] ci: Harden GitHub Actions (#488)
Browse files Browse the repository at this point in the history
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
  • Loading branch information
step-security-bot authored Nov 14, 2024
1 parent 186c2e4 commit 091b586
Show file tree
Hide file tree
Showing 25 changed files with 135 additions and 66 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: src/pg_stat_monitor

- name: Checkout cppcheck sources
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "danmar/cppcheck"
ref: "2.13.4"
Expand Down Expand Up @@ -43,13 +43,13 @@ jobs:

steps:
- name: Clone postgres repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'postgres/postgres'
ref: 'REL_17_STABLE'

- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'contrib/pg_stat_monitor'

Expand Down Expand Up @@ -87,9 +87,9 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Check license headers
uses: apache/skywalking-eyes/header@v0.6.0
uses: apache/skywalking-eyes/header@cd7b195c51fd3d6ad52afceb760719ddc6b3ee91 # v0.6.0
with:
token: "" # Prevent comments
11 changes: 7 additions & 4 deletions .github/workflows/code-coverage-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
build:
name: coverage-test
Expand All @@ -13,7 +16,7 @@ jobs:

steps:
- name: Clone postgres repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'postgres/postgres'
ref: 'REL_15_STABLE'
Expand Down Expand Up @@ -80,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -110,7 +113,7 @@ jobs:
working-directory: src/pg_stat_monitor

- name: Upload
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -127,7 +130,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pgxn-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
required: true
type: string

permissions:
contents: read

jobs:
release:
name: Release
Expand All @@ -19,7 +22,7 @@ jobs:
shell: bash

- name: Check out
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: '${{ inputs.version }}'

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/postgresql-12-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-12-build-test
Expand All @@ -15,7 +18,7 @@ jobs:

steps:
- name: Clone postgres repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'postgres/postgres'
ref: 'REL_12_STABLE'
Expand Down Expand Up @@ -81,7 +84,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -115,7 +118,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand All @@ -138,7 +141,7 @@ jobs:
make installcheck-world
- name: Report on installcheck-world test suites fail
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ failure() }}
with:
name: Regressions output files of failed testsuite, and pg log
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/postgresql-12-pgdg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-12-pgdg-package-test
Expand All @@ -15,7 +18,7 @@ jobs:

steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -77,7 +80,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/postgresql-12-pmm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-12-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'
Expand All @@ -39,7 +42,7 @@ jobs:
run: docker exec pgsql_pgsm_12 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log

- name: Upload Tests Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/postgresql-12-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-12-ppg-package-test
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -92,7 +95,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/postgresql-13-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-13-build-test
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Clone postgres repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'postgres/postgres'
ref: 'REL_13_STABLE'
Expand Down Expand Up @@ -80,7 +83,7 @@ jobs:
pg_ctl -D /opt/pgsql/data -l logfile start
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -114,7 +117,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand All @@ -137,7 +140,7 @@ jobs:
make installcheck-world
- name: Report on installcheck-world test suites fail
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ failure() }}
with:
name: Regressions output files of failed testsuite, and pg log
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/postgresql-13-pgdg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-13-pgdg-package-test
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -76,7 +79,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/postgresql-13-pmm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-13-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'
Expand All @@ -39,7 +42,7 @@ jobs:
run: docker exec pgsql_pgsm_13 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log

- name: Upload Tests Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/postgresql-13-ppg-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: read

jobs:
build:
name: pg-13-ppg-package-test
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Clone pg_stat_monitor repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'src/pg_stat_monitor'

Expand Down Expand Up @@ -89,7 +92,7 @@ jobs:

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Regressions diff and postgresql log
path: |
Expand Down
Loading

0 comments on commit 091b586

Please sign in to comment.