Bug/debug bad data gwas upload #283
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |