adding current_commit arg to write_update_commit #26
This file contains 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
on: | |
push: | |
branches: [main, master, mongo_upsert] | |
pull_request: | |
branches: [main, master, mongo_upsert] | |
name: test-coverage | |
jobs: | |
test-coverage: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Get runner IP | |
run: echo "RUNNER_IP=$(curl ifconfig.me)" >> $GITHUB_ENV | |
shell: bash | |
- name: Whitelist IP | |
env: | |
MONGO_API_PUBLIC: ${{secrets.MONGO_API_PUBLIC}} | |
MONGO_API_PRIVATE: ${{secrets.MONGO_API_PRIVATE}} | |
MONGODB_PROJECT_ID: ${{secrets.MONGODB_PROJECT_ID}} | |
run: | | |
curl --location "https://cloud.mongodb.com/api/atlas/v1.0/groups/$MONGODB_PROJECT_ID/accessList" \ | |
--digest -u "$MONGO_API_PUBLIC:$MONGO_API_PRIVATE" \ | |
--header "Content-Type: application/json" \ | |
--data '[ | |
{ | |
"ipAddress": "'$RUNNER_IP'/32", | |
"comment": "Added via GitHub db-update action" | |
} | |
]' | |
shell: bash | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::covr | |
needs: coverage | |
- name: Test coverage | |
env: | |
MONGODB_URL_DEV: ${{secrets.MONGODB_URL_DEV}} | |
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} | |
run: | | |
install.packages('remotes') | |
remotes::install_github("allometric/allometric") | |
covr::codecov( | |
quiet = FALSE, | |
clean = FALSE, | |
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package"), | |
token = Sys.getenv("CODECOV_TOKEN") | |
) | |
shell: Rscript {0} | |
- name: Show testthat output | |
if: always() | |
run: | | |
## -------------------------------------------------------------------- | |
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-test-failures | |
path: ${{ runner.temp }}/package | |
- name: Remove IP | |
env: | |
MONGO_API_PUBLIC: ${{secrets.MONGO_API_PUBLIC}} | |
MONGO_API_PRIVATE: ${{secrets.MONGO_API_PRIVATE}} | |
MONGODB_PROJECT_ID: ${{secrets.MONGODB_PROJECT_ID}} | |
run: | | |
curl --request DELETE \ | |
--location "https://cloud.mongodb.com/api/atlas/v1.0/groups/$MONGODB_PROJECT_ID/accessList/${RUNNER_IP}%2F32" \ | |
--digest -u "$MONGO_API_PUBLIC:$MONGO_API_PRIVATE" | |
shell: bash |