From 4f4487749c84e53e3ec8b4cf6d52c836ad6fa510 Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Mon, 22 Jan 2024 17:56:14 +0100 Subject: [PATCH] improve workflows --- .github/workflows/astro.yml | 62 -------------------------------- .github/workflows/run-checks.yml | 43 ++++++++++++++++++++++ .github/workflows/run-tests.yml | 2 +- 3 files changed, 44 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/astro.yml create mode 100644 .github/workflows/run-checks.yml diff --git a/.github/workflows/astro.yml b/.github/workflows/astro.yml deleted file mode 100644 index cbd2d48..0000000 --- a/.github/workflows/astro.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Sample workflow for building and deploying an Astro site to GitHub Pages -# -# To get started with Astro see: https://docs.astro.build/en/getting-started/ -# -name: Build & Deploy - -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "18" - cache: npm - cache-dependency-path: ./package-lock.json - - - name: Cache .astro - uses: actions/cache@v4 - with: - path: ./example/node_modules - key: astro-cache-${{ github.run_id }} - restore-keys: astro-cache - - - name: Install dependencies - run: npm install - - - name: Build with Astro - run: npm run build - - - name: Prepare tests - run: npx playwright install - - - name: Run tests - run: npm test - - - name: Publish to Cloudflare Pages - uses: cloudflare/pages-action@v1 - with: - apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: events - directory: ./example/dist diff --git a/.github/workflows/run-checks.yml b/.github/workflows/run-checks.yml new file mode 100644 index 0000000..3bd1b21 --- /dev/null +++ b/.github/workflows/run-checks.yml @@ -0,0 +1,43 @@ +# Sample workflow for building and deploying an Astro site to GitHub Pages +# +# To get started with Astro see: https://docs.astro.build/en/getting-started/ +# +name: Run Checks + +on: + workflow_dispatch: + pull_request: + branches: [ main ] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "18" + cache: npm + cache-dependency-path: ./package-lock.json + + - name: Cache .astro + uses: actions/cache@v4 + with: + path: ./example/node_modules + key: astro-cache-${{ github.run_id }} + restore-keys: astro-cache + + - name: Install dependencies + run: npm ci + + - name: Prepare tests + run: npx playwright install --with-deps + + - name: Run tests + run: npm test + + \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1cc8563..e72d78a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,7 +6,7 @@ name: Run Tests on: workflow_dispatch: - pull_request: + push: branches: [ main ] jobs: