From aec743a60cab5e992c5ccbfb54072c409e87f646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gavil=C3=A1n?= Date: Sun, 18 Feb 2024 11:27:50 +0100 Subject: [PATCH 1/3] feat: Caching docker images github actions --- .github/workflows/clang-format.yml | 3 +++ .github/workflows/pull_request_checks.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 40bf8f5..d13b7b6 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,6 +19,9 @@ jobs: - name: Set up Clang-Format run: sudo apt-get install -y clang-format + with: + cache: 'yarn' + cache-dependency-path: yarn.lock - name: Format source code run: clang-format -i game/**/*.cpp game/**/*.hpp --ferror-limit=0 --style file:.clang-format --verbose diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index d4b68c7..cb6f2d3 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -16,6 +16,9 @@ jobs: uses: actions/checkout@v3 - name: Build docker image run: docker-compose build + with: + cache: 'yarn' + cache-dependency-path: yarn.lock - name: Run tests run: docker-compose run test From 6b32fc2c98011409b7004d39b92a05c1d24bde5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gavil=C3=A1n?= Date: Sun, 18 Feb 2024 12:12:44 +0100 Subject: [PATCH 2/3] fix: Propper cashing --- .github/workflows/clang-format.yml | 8 ++++++-- .github/workflows/pull_request_checks.yml | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index d13b7b6..0ee34e4 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,9 +19,13 @@ jobs: - name: Set up Clang-Format run: sudo apt-get install -y clang-format + + - name: Cache clang image + id: cache-clang-formatter + uses: actions/cache@v4 with: - cache: 'yarn' - cache-dependency-path: yarn.lock + path: clang-formatter + key: ${{ runner.os }}-clang-formatter - name: Format source code run: clang-format -i game/**/*.cpp game/**/*.hpp --ferror-limit=0 --style file:.clang-format --verbose diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index cb6f2d3..c10c50e 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -16,9 +16,12 @@ jobs: uses: actions/checkout@v3 - name: Build docker image run: docker-compose build + - name: Cache project dependencies image + id: cache-project-dependencies + uses: actions/cache@v4 with: - cache: 'yarn' - cache-dependency-path: yarn.lock + path: project-dependencies + key: ${{ runner.os }}-project-dependencies - name: Run tests run: docker-compose run test From d7c53d790b425954391dc5077c780a860cdb0af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gavil=C3=A1n?= Date: Sun, 18 Feb 2024 12:16:15 +0100 Subject: [PATCH 3/3] fix: Cache path --- .github/.build-caching/README.md | 3 +++ .github/workflows/clang-format.yml | 2 +- .github/workflows/pull_request_checks.yml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/.build-caching/README.md diff --git a/.github/.build-caching/README.md b/.github/.build-caching/README.md new file mode 100644 index 0000000..551a82e --- /dev/null +++ b/.github/.build-caching/README.md @@ -0,0 +1,3 @@ +# Build caching + +Here go all the cached builds that github actions require \ No newline at end of file diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 0ee34e4..8b2bdcc 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -24,7 +24,7 @@ jobs: id: cache-clang-formatter uses: actions/cache@v4 with: - path: clang-formatter + path: .github/build-caching key: ${{ runner.os }}-clang-formatter - name: Format source code diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index c10c50e..9278c97 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -20,7 +20,7 @@ jobs: id: cache-project-dependencies uses: actions/cache@v4 with: - path: project-dependencies + path: .github/build-caching key: ${{ runner.os }}-project-dependencies - name: Run tests run: docker-compose run test