-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (86 loc) · 3.04 KB
/
main.yml
File metadata and controls
96 lines (86 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- name: Install lintr
run: Rscript -e 'install.packages("lintr", repos = "https://cloud.r-project.org")'
- name: Run linter
run: make lint
- name: Check that tests have been run successfully
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
if [ ! -f tests/testing_complete.txt ]; then
echo "Tests have not been run successfully, please run Rscript tests/testthat/run_tests.R and commit the results"
exit 1
fi
if [ "$BRANCH_NAME" != "main" ] && ! grep -q "$BRANCH_NAME" tests/testing_complete.txt; then
echo "Tests have not been run successfully for branch: $BRANCH_NAME, please run Rscript tests/testthat/run_tests.R and commit the results"
exit 1
fi
build:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Clean up Docker system and free up space
run: |
docker system prune -af --volumes || true
docker builder prune -af || true
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Set up SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ORACLE_SSH_PRIVATE_KEY }}" > ~/.ssh/oracle_gpmap.key
chmod 600 ~/.ssh/oracle_gpmap.key
ssh-keyscan -H "${{ secrets.ORACLE_SERVER }}" >> ~/.ssh/known_hosts
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push API image
uses: docker/build-push-action@v4
with:
file: docker/uploadDockerfile
context: .
push: true
load: false
no-cache: true
provenance: false
cache-from: ""
cache-to: ""
tags: |
mrcieu/genotype-phenotype-upload:latest
mrcieu/genotype-phenotype-upload:${{ github.sha }}
platforms: linux/amd64
- name: Clean up Docker after build
if: always()
run: |
docker system prune -af --volumes || true
docker builder prune -af || true
# Remove the base image if it's taking up space
docker rmi mrcieu/genotype-phenotype-map:1.0.0 || true
df -h
- name: Populate .env files and copy deployment files to server
env:
ORACLE_SERVER: ${{ secrets.ORACLE_SERVER }}
run: |
FILES=".env.pipeline_worker"
scp -i ~/.ssh/oracle_gpmap.key $FILES opc@${ORACLE_SERVER}:/home/opc/genotype-phenotype-api/