Skip to content

Commit bdc9cb2

Browse files
authored
Fix the docker image builds (#14)
* fix auth * fix creds * format the files * free disk space * added the test * format * fix the disk space * fix the disk space 2 * added the scheduler * remove haskell --------- Co-authored-by: xqhu <xqhu@google.com>
1 parent 4f29dc0 commit bdc9cb2

File tree

2 files changed

+54
-31
lines changed

2 files changed

+54
-31
lines changed

.github/workflows/docker.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,58 @@
1515
name: Build and push Docker image to GCP Artifact Registry
1616

1717
on:
18-
workflow_dispatch:
19-
push:
20-
branches:
21-
- main
18+
workflow_dispatch:
19+
push:
20+
branches:
21+
- main
22+
schedule:
23+
# Every Monday at 1PM UTC (9AM EST)
24+
- cron: "0 13 * * 1"
2225

2326
jobs:
2427
build-and-push:
2528
runs-on: ubuntu-latest
2629

2730
steps:
31+
- name: Free Disk Space (Ubuntu)
32+
uses: jlumbroso/free-disk-space@main
33+
with:
34+
# this might remove tools that are actually needed,
35+
# if set to "true" but frees about 6 GB
36+
tool-cache: false
37+
38+
android: true
39+
dotnet: true
40+
haskell: true
41+
large-packages: false
42+
docker-images: true
43+
swap-storage: true
2844
- name: Checkout
2945
uses: actions/checkout@v3
30-
- name: Authenticate to Google Cloud
46+
- id: "auth"
47+
name: Authenticate to Google Cloud
3148
uses: google-github-actions/auth@v1.1.1
3249
with:
3350
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
3451
token_format: access_token
35-
- name: Docker login -
36-
uses: 'docker/login-action@v1'
52+
- name: Docker login
53+
uses: "docker/login-action@v1"
3754
with:
38-
registry: 'us-docker.pkg.dev'
39-
username: 'oauth2accesstoken'
40-
password: '${{ steps.auth.outputs.access_token }}'
55+
registry: "us-docker.pkg.dev"
56+
username: "oauth2accesstoken"
57+
password: "${{ steps.auth.outputs.access_token }}"
58+
- name: Set up Python 3.8
59+
uses: actions/setup-python@v4
60+
with:
61+
python-version: "3.8"
4162
- name: Init env
4263
run: |
43-
cp tests/sample.env.tf .env
44-
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
45-
make init
64+
cp tests/sample.env.tf .env
65+
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
66+
make init
4667
- name: Build and push Docker image
4768
run: |
4869
make docker
70+
- name: Test Docker image
71+
run: |
72+
make run-df-gpu

.github/workflows/pr.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,35 @@ on: [push, pull_request, workflow_dispatch]
1818

1919
jobs:
2020
tests:
21-
2221
runs-on: ubuntu-latest
2322

2423
steps:
2524
- uses: actions/checkout@v3
2625
- name: Set up Python 3.8
2726
uses: actions/setup-python@v4
2827
with:
29-
python-version: '3.8'
28+
python-version: "3.8"
3029
- name: Init env
3130
run: |
32-
cp tests/sample.env.tf .env
33-
make init
31+
cp tests/sample.env.tf .env
32+
make init
3433
- name: Run local tests
3534
run: |
36-
make test
35+
make test
3736
- name: Run DirectRunner with TF
3837
run: |
39-
# tf model
40-
make run-direct
41-
test -f beam-output/beam_test_out.txt && echo "DirectRunner ran successfully!" || $(error "Cannot find beam-output/beam_test_out.txt!")
38+
# tf model
39+
make run-direct
40+
test -f beam-output/beam_test_out.txt && echo "DirectRunner ran successfully!" || $(error "Cannot find beam-output/beam_test_out.txt!")
4241
- name: Run DirectRunner with PyTorch
4342
run: |
44-
# torch model
45-
sed -i '/TF_MODEL_URI=/d' .env
46-
echo -e "\n" >> .env
47-
echo "MODEL_STATE_DICT_PATH=gs://apache-beam-ml/models/torchvision.models.mobilenet_v2.pth" >> .env
48-
echo -e "\n" >> .env
49-
echo "MODEL_NAME=mobilenet_v2" >> .env
50-
make run-direct
51-
test -f beam-output/beam_test_out.txt && echo "DirectRunner ran successfully!" || $(error "Cannot find beam-output/beam_test_out.txt!")
52-
# restore .env
53-
cp tests/sample.env.tf .env
43+
# torch model
44+
sed -i '/TF_MODEL_URI=/d' .env
45+
echo -e "\n" >> .env
46+
echo "MODEL_STATE_DICT_PATH=gs://apache-beam-ml/models/torchvision.models.mobilenet_v2.pth" >> .env
47+
echo -e "\n" >> .env
48+
echo "MODEL_NAME=mobilenet_v2" >> .env
49+
make run-direct
50+
test -f beam-output/beam_test_out.txt && echo "DirectRunner ran successfully!" || $(error "Cannot find beam-output/beam_test_out.txt!")
51+
# restore .env
52+
cp tests/sample.env.tf .env

0 commit comments

Comments
 (0)