From 9526093767c165f220e889b78e57d411dc0802f2 Mon Sep 17 00:00:00 2001 From: Jozef Harag Date: Thu, 7 Nov 2024 14:30:54 +0100 Subject: [PATCH] chore: create setup action (#888) --- .github/actions/setup/action.yml | 17 ++++++++++++++++ .github/workflows/check-links.yml | 4 ++-- .github/workflows/ci-main.yml | 21 ++++++-------------- .github/workflows/ci.yml | 32 +++++++++++++------------------ 4 files changed, 38 insertions(+), 36 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..014c67ce --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,17 @@ +name: 'Setup' +description: 'Setup node, install deps, compile' +runs: + using: 'composite' + steps: + - uses: actions/setup-node@v4.1.0 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + shell: bash + run: npm ci + + - name: Build project + shell: bash + run: npm run compile diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index 3bfd8dd0..47787740 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -9,9 +9,9 @@ jobs: linkChecker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.2.1 + - uses: actions/checkout@v4.2.2 - name: Link Checker - uses: lycheeverse/lychee-action@v1.8.0 + uses: lycheeverse/lychee-action@v2.1.0 with: fail: true diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 06616716..a54b9ac2 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -11,17 +11,12 @@ jobs: permissions: read-all steps: - name: Checkout - uses: actions/checkout@v4.2.1 - - uses: actions/setup-node@v4.0.3 - with: - node-version: '18' - cache: 'npm' - - run: npm ci + uses: actions/checkout@v4.2.2 + - name: Setup + uses: ./.github/actions/setup - run: npm run version:check - name: Lint code run: npm run lint - - name: Lint docs - run: npm run lint:markdown - name: Transpile code run: npm run compile - name: Unit test @@ -36,12 +31,8 @@ jobs: browser: [headlessChrome, headlessFirefox] steps: - name: Checkout - uses: actions/checkout@v4.2.1 - - uses: actions/setup-node@v4.0.3 - with: - node-version: '18' - cache: 'npm' - - run: npm ci - - run: npm run compile + uses: actions/checkout@v4.2.2 + - name: Setup + uses: ./.github/actions/setup - name: Local integration tests using ${{ matrix.browser }} run: npm run test:integration:local:${{ matrix.browser }}:_execute diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c446e61..c7d77974 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,11 +10,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4.2.1 - - uses: actions/setup-node@v4.0.3 - with: - node-version: '18' - cache: 'npm' - - run: npm ci + - name: Setup + uses: ./.github/actions/setup - run: npm run version:check - name: Lint code run: npm run lint @@ -47,13 +44,11 @@ jobs: accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} tunnelName: ${{ secrets.SAUCE_TUNNEL_ID }} - name: Checkout - uses: actions/checkout@v4.2.1 - - uses: actions/setup-node@v4.0.3 - with: - node-version: '18' - cache: 'npm' - - run: npm ci - - run: npm run compile + uses: actions/checkout@v4.2.2 + + - name: Setup + uses: ./.github/actions/setup + - name: Add to hosts file run: echo "127.0.0.1 local.test" | sudo tee -a /etc/hosts - name: Run integration tests in Saucelabs @@ -69,15 +64,14 @@ jobs: browser: [headlessChrome, headlessFirefox] steps: - name: Checkout - uses: actions/checkout@v4.2.1 - - uses: actions/setup-node@v4.0.3 - with: - node-version: '18' - cache: 'npm' - - run: npm ci - - run: npm run compile + uses: actions/checkout@v4.2.2 + + - name: Setup + uses: ./.github/actions/setup + - name: Local integration tests using ${{ matrix.browser }} run: npm run test:integration:local:${{ matrix.browser }}:_execute + - name: Upload test logs uses: actions/upload-artifact@v3.1.2 if: ${{ failure() }}