From 3c38c73ad0b5d2935e6453e0bca1b2063c07708b Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Wed, 22 Jan 2025 08:45:29 +0100 Subject: [PATCH] Add GH action that runs the automated-tests every night --- .github/workflows/automated-tests.yaml | 84 ++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/automated-tests.yaml diff --git a/.github/workflows/automated-tests.yaml b/.github/workflows/automated-tests.yaml new file mode 100644 index 000000000..4e87b5c34 --- /dev/null +++ b/.github/workflows/automated-tests.yaml @@ -0,0 +1,84 @@ +name: Scheduled Automated Tests +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }} + +env: + VITE_PORTAL_API_URL: ${{ vars.VITE_PORTAL_API_URL }} + +jobs: + run: + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + matrix: + gateway: + - '3.9' + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + # Configure Ruby to build Jekyll site + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: .ruby-version + - name: Ruby gem cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Bundle Setup + run: bundle config path ${{ github.workspace }}/vendor/bundle + - name: Bundle Install + run: bundle install --jobs 4 --retry 3 + + # Configure Node to build assets + - uses: actions/setup-node@v4 + with: + node-version: "20" + - name: Cache node modules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + + - name: npm install + run: npm ci + + - name: Run site + run: | + npx netlify dev & npx wait-on http://localhost:8888 + + - name: Download Kong License + uses: Kong/kong-license@master + id: getLicense + with: + op-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + + - name: Generate instruction files + working-directory: tools/automated-tests + run: | + npm ci + npm run generate-instruction-files + + - name: Run tests + working-directory: tools/automated-tests + env: + KONG_LICENSE_DATA: ${{ steps.getLicense.outputs.license }} + RUNTIME: gateway + GATEWAY_VERSION: ${{ matrix.gateway }} + run: | + npm run run-tests