Skip to content

Commit c1c380c

Browse files
committed
Fix cache for github actions
1 parent a02b6b6 commit c1c380c

2 files changed

Lines changed: 32 additions & 73 deletions

File tree

.github/workflows/master.yml

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,21 @@ jobs:
2222
--health-retries 5
2323
2424
steps:
25-
- name: Notify Rollbar of deploy start
26-
uses: rollbar/[email protected]
27-
id: rollbar_pre_deploy
28-
with:
29-
environment: 'production'
30-
version: ${{ github.sha }}
31-
status: 'started'
32-
env:
33-
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}
34-
ROLLBAR_USERNAME: ${{ secrets.ROLLBAR_USERNAME }}
35-
36-
- uses: actions/checkout@v2
37-
38-
- uses: erlef/setup-beam@v1
25+
- uses: actions/checkout@v3
26+
- name: Setup Elixir
27+
uses: erlef/setup-beam@v1
3928
with:
4029
otp-version: '25.2'
4130
elixir-version: '1.14.3'
42-
43-
- uses: actions/cache@v2
31+
- name: Restore mix build cache
32+
uses: actions/cache@v3
4433
with:
45-
path: services/app/deps
46-
key: v3-${{ runner.os }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/services/app/mix.lock')) }}
47-
restore-keys: |
48-
v3-${{ runner.os }}-deps-
49-
50-
- uses: actions/cache@v2
51-
with:
52-
path: services/app/_build
53-
key: v3-${{ runner.os }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/services/app/mix.lock')) }}
54-
restore-keys: |
55-
v3-${{ runner.os }}-build-
56-
57-
- uses: actions/cache@v2
58-
with:
59-
path: ~/.mix
60-
key: v3-${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/services/app/mix.lock')) }}
61-
restore-keys: |
62-
v3-${{ runner.os }}-mix-
34+
path: |
35+
deps
36+
_build
37+
~/.mix
38+
key: mix:1-${{ hashFiles('**/mix.lock') }}
39+
restore-keys: mix:1-
6340

6441
- name: Get deps
6542
run: mix deps.get
@@ -87,7 +64,7 @@ jobs:
8764
id: yarn-cache
8865
run: echo "::set-output name=dir::$(yarn cache dir)"
8966

90-
- uses: actions/cache@v2
67+
- uses: actions/cache@v3
9168
with:
9269
path: ${{ steps.yarn-cache.outputs.dir }}
9370
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
@@ -133,21 +110,14 @@ jobs:
133110
- name: Login to Docker Hub
134111
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
135112

136-
- run: make docker-build-codebattle
137-
- run: make docker-push-codebattle
138-
- run: make docker-build-runner
139-
- run: make docker-push-runner
140-
141-
- name: Notify Rollbar of deploy finish
142-
uses: rollbar/[email protected]
143-
id: rollbar_post_deploy
144-
with:
145-
environment: 'production'
146-
version: ${{ github.sha }}
147-
status: 'succeeded'
148-
env:
149-
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}
150-
ROLLBAR_USERNAME: ${{ secrets.ROLLBAR_USERNAME }}
113+
- name: Build docker image for codebattle
114+
run: make docker-build-codebattle
115+
- name: Push docker image for codebattle
116+
run: make docker-push-codebattle
117+
- name: Build docker image for runner
118+
run: make docker-build-runner
119+
- name: Push docker image for runner
120+
run: make docker-push-runner
151121

152122
# stop integratoin tests on CI becaues of https://github.com/hexlet-codebattle/codebattle/runs/580337561?check_suite_focus=true
153123
# - name: Pull dockers

.github/workflows/pr.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,21 @@ jobs:
2121
--health-retries 5
2222
2323
steps:
24-
- uses: actions/checkout@v2
25-
- uses: erlef/setup-beam@v1
24+
- uses: actions/checkout@v3
25+
- name: Setup Elixir
26+
uses: erlef/setup-beam@v1
2627
with:
2728
otp-version: '25.0.3'
2829
elixir-version: '1.13.4'
29-
30-
- uses: actions/cache@v2
31-
with:
32-
path: services/app/deps
33-
key: v3-${{ runner.os }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/services/app/mix.lock')) }}
34-
restore-keys: |
35-
v3-${{ runner.os }}-deps-
36-
37-
- uses: actions/cache@v2
30+
- name: Restore mix build cache
31+
uses: actions/cache@v3
3832
with:
39-
path: services/app/_build
40-
key: v3-${{ runner.os }}-build-${{ hashFiles(format('{0}{1}', github.workspace, '/services/app/mix.lock')) }}
41-
restore-keys: |
42-
v3-${{ runner.os }}-build-
43-
44-
- uses: actions/cache@v2
45-
with:
46-
path: ~/.mix
47-
key: v3-${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/services/app/mix.lock')) }}
48-
restore-keys: |
49-
v3-${{ runner.os }}-mix-
33+
path: |
34+
deps
35+
_build
36+
~/.mix
37+
key: mix:1-${{ hashFiles('**/mix.lock') }}
38+
restore-keys: mix:1-
5039

5140
- name: Get deps
5241
run: mix deps.get
@@ -74,7 +63,7 @@ jobs:
7463
id: yarn-cache
7564
run: echo "::set-output name=dir::$(yarn cache dir)"
7665

77-
- uses: actions/cache@v2
66+
- uses: actions/cache@v3
7867
with:
7968
path: ${{ steps.yarn-cache.outputs.dir }}
8069
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

0 commit comments

Comments
 (0)