From fe6df3a077611ae685cb7dc4d2f93748a7626185 Mon Sep 17 00:00:00 2001 From: Kirill Nikolaev Date: Tue, 27 Feb 2024 16:50:37 +0100 Subject: [PATCH] Add a workflow to test caching when the job requires container environment. --- .github/workflows/in-container.yaml | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/in-container.yaml diff --git a/.github/workflows/in-container.yaml b/.github/workflows/in-container.yaml new file mode 100644 index 0000000..3e0778e --- /dev/null +++ b/.github/workflows/in-container.yaml @@ -0,0 +1,43 @@ +name: Test in a container +on: + push: + branches: + - main + pull_request: + branches: + - "*" + workflow_dispatch: + +permissions: + contents: read + +jobs: + in-container: + runs-on: + - namespace-profile-e2e-small + + container: + image: node:21 + env: + NSC_CACHE_PATH: ${{ env.NSC_CACHE_PATH }} + volumes: + - /cache:/cache + options: --cap-add=SYS_ADMIN + + steps: + - uses: actions/checkout@v4 + + - name: Install sudo + run: | + apt-get update -y && apt-get install -y sudo + + - name: Set up Nix cache + uses: namespacelabs/nscloud-cache-action@344aba36b864a47c4bae7ea0c0aff4cda7e6d50a + with: + path: .npm + + - name: Run npm install + run: npm install + + - name: Print cache metadata file + run: cat /cache/.ns/cache-metadata.json