From c2bd39248c7172a966172de17d927012d78a92bb Mon Sep 17 00:00:00 2001 From: Alexey Solodkiy <alexey@solodkiy.by> Date: Mon, 30 Sep 2024 00:09:23 +0300 Subject: [PATCH] CI --- .github/workflows/ci.yml | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8d104f8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +name: CI Workflow + +on: + push: + branches: + - main + tags: + - '*' + pull_request: + +jobs: + unit_test: + name: Unit Tests + runs-on: ubuntu-latest + container: + image: golang:1.21 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run unit tests + run: go test -v ./... + + compile: + name: Build + runs-on: ubuntu-latest + container: + image: golang:1.21 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Compile Go application + run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gauge-exporter -buildvcs=false -ldflags "-X main.appVersion=${{ github.ref_name }}" + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: gauge-exporter + path: gauge-exporter + retention-days: 1 + + e2e_test: + name: End-to-End Tests + runs-on: ubuntu-latest + container: + image: php:8.3 + needs: compile + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: gauge-exporter + + - name: Install dependencies + uses: php-actions/composer@v6 + env: + COMPOSER: "composer.json" + with: + php_version: "8.3" + version: "2.2" + args: "--optimize-autoloader" + working_dir: "e2e_tests" + + - name: Run E2E tests + run: ./vendor/bin/phpunit --testdox + working-directory: e2e_tests + +