diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/docker.yml | 41 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 40 | ||||
| -rw-r--r-- | .github/workflows/test.yml | 19 |
3 files changed, 96 insertions, 4 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..b44e0b7 --- /dev/null +++ b/.github/workflows/docker.yml | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | name: Docker | ||
| 2 | |||
| 3 | on: | ||
| 4 | push: | ||
| 5 | branches: | ||
| 6 | - master | ||
| 7 | tags: | ||
| 8 | - '*' | ||
| 9 | pull_request: | ||
| 10 | branches: | ||
| 11 | - master | ||
| 12 | |||
| 13 | jobs: | ||
| 14 | |||
| 15 | docker-image: | ||
| 16 | name: Build Image | ||
| 17 | runs-on: ubuntu-latest | ||
| 18 | |||
| 19 | steps: | ||
| 20 | - name: Checkout code | ||
| 21 | uses: actions/checkout@v3 | ||
| 22 | |||
| 23 | - name: Setup docker | ||
| 24 | uses: docker/setup-buildx-action@v1 | ||
| 25 | |||
| 26 | - name: Log into container registry | ||
| 27 | uses: docker/login-action@v1 | ||
| 28 | with: | ||
| 29 | registry: ghcr.io | ||
| 30 | username: ${{ github.repository_owner }} | ||
| 31 | password: ${{ secrets.GITHUB_TOKEN }} | ||
| 32 | |||
| 33 | - name: Build image | ||
| 34 | run: make docker | ||
| 35 | |||
| 36 | - name: Test image | ||
| 37 | run: make docker-tests | ||
| 38 | |||
| 39 | - name: Publish image | ||
| 40 | if: github.event_name != 'pull_request' | ||
| 41 | run: make docker-publish | ||
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6b1647a --- /dev/null +++ b/.github/workflows/release.yml | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | name: Release | ||
| 2 | |||
| 3 | on: | ||
| 4 | push: | ||
| 5 | tags: | ||
| 6 | - '*' | ||
| 7 | |||
| 8 | jobs: | ||
| 9 | |||
| 10 | release: | ||
| 11 | name: Release | ||
| 12 | runs-on: ubuntu-latest | ||
| 13 | |||
| 14 | steps: | ||
| 15 | - uses: actions/checkout@v3 | ||
| 16 | |||
| 17 | - name: Set up Go | ||
| 18 | uses: actions/setup-go@v3 | ||
| 19 | with: | ||
| 20 | go-version: '^1.18' | ||
| 21 | |||
| 22 | # apt repos don't have YARA v4.2, install it from git | ||
| 23 | - name: Install YARA | ||
| 24 | run: | | ||
| 25 | git clone --depth 1 https://github.com/virustotal/yara.git | ||
| 26 | cd yara | ||
| 27 | bash ./build.sh | ||
| 28 | sudo make install | ||
| 29 | cd .. | ||
| 30 | |||
| 31 | - name: Build | ||
| 32 | run: make | ||
| 33 | |||
| 34 | - name: Create release | ||
| 35 | uses: ncipollo/release-action@v1 | ||
| 36 | with: | ||
| 37 | artifacts: "php-malware-finder" | ||
| 38 | token: ${{ secrets.GITHUB_TOKEN }} | ||
| 39 | allowUpdates: true | ||
| 40 | omitBody: true | ||
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f29e422..a3cbc35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
| @@ -9,17 +9,25 @@ on: | |||
| 9 | - master | 9 | - master |
| 10 | 10 | ||
| 11 | jobs: | 11 | jobs: |
| 12 | |||
| 12 | test: | 13 | test: |
| 13 | name: Test | 14 | name: Test |
| 14 | runs-on: ubuntu-latest | 15 | runs-on: ubuntu-latest |
| 16 | strategy: | ||
| 17 | matrix: | ||
| 18 | go_version: | ||
| 19 | - '~1.16' | ||
| 20 | - '~1.17' | ||
| 21 | - '^1.18' | ||
| 22 | |||
| 15 | steps: | 23 | steps: |
| 16 | - name: Checkout code | 24 | - name: Checkout code |
| 17 | uses: actions/checkout@v2 | 25 | uses: actions/checkout@v3 |
| 18 | 26 | ||
| 19 | - name: Setup Go | 27 | - name: Setup Go |
| 20 | uses: actions/setup-go@v2 | 28 | uses: actions/setup-go@v3 |
| 21 | with: | 29 | with: |
| 22 | go-version: '^1.17' | 30 | go-version: ${{ matrix.go_version }} |
| 23 | 31 | ||
| 24 | # apt repos don't have YARA v4.2, install it from git | 32 | # apt repos don't have YARA v4.2, install it from git |
| 25 | - name: Install YARA | 33 | - name: Install YARA |
| @@ -32,4 +40,7 @@ jobs: | |||
| 32 | 40 | ||
| 33 | - name: Run tests | 41 | - name: Run tests |
| 34 | run: | | 42 | run: | |
| 35 | LD_LIBRARY_PATH=/usr/local/lib make tests | 43 | make |
| 44 | make tests | ||
| 45 | env: | ||
| 46 | LD_LIBRARY_PATH: /usr/local/lib | ||
