diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 000000000..3e23391ed --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,23 @@ +name: Setup repository for CI tests +runs: + using: composite + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: .tool-versions + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + shell: bash + + - uses: actions/cache@v4 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - run: yarn --immutable + shell: bash diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d10c75053..2059c6977 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -10,21 +10,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - run: yarn lint:eslint prettier: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - run: yarn lint:prettier tsc: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - run: yarn lint:tsc test: @@ -32,7 +32,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: serlo/configure-repositories/actions/setup-mysql@main - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - run: yarn start:containers - run: scripts/mysql/wait-for-mysql.sh - run: yarn migrate:all @@ -47,7 +47,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - run: yarn codegen - name: Check for uncommitted changes run: | diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 344e83e1e..d9575aa9d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index eaec4ba9a..9defa6755 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,7 +23,7 @@ jobs: build-args: | image=${{ matrix.image }} tags: api-${{ matrix.image }}-local-build:latest - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - name: Start containers run: yarn start:containers - name: Wait until all containers are ready diff --git a/.github/workflows/push-migration-image.yml b/.github/workflows/push-migration-image.yml index 3872bad95..fbe6b03fc 100644 --- a/.github/workflows/push-migration-image.yml +++ b/.github/workflows/push-migration-image.yml @@ -9,7 +9,7 @@ jobs: if: ${{ github.actor != 'dependabot[bot]' }} steps: - uses: actions/checkout@v4 - - uses: serlo/configure-repositories/actions/setup-node@main + - uses: ./.github/actions/setup-node - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: