Created
January 10, 2023 10:25
-
-
Save tomdewildt/487692183385181defb05aef034f0657 to your computer and use it in GitHub Desktop.
Common steps for the github actions platform
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
# Install golang dependencies | |
- name: Install dependencies | |
run: go mod download | |
# Install javascript dependencies | |
- name: Install dependencies | |
run: npm install | |
# Install python dependencies | |
- name: Install dependencies | |
run: | | |
for f in requirements/*.txt; do | |
pip install -r "$f"; | |
done | |
# Install r dependencies | |
- name: Install dependencies | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore() | |
shell: Rscript {0} | |
# Install operating system dependencies | |
- name: Setup os | |
run: sudo apt-get -y package | |
# Upload golang coverage | |
- name: Run test | |
run: go test -race -coverprofile=coverage.out -covermode=atomic ./... | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.out | |
fail_ci_if_error: true | |
# Upload javascript coverage | |
- name: Run test | |
run: npm run test -- --coverage | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage/lcov.info | |
fail_ci_if_error: true | |
# Upload python coverage | |
- name: Run test | |
run: pytest --cov=module --cov-report=xml test | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
fail_ci_if_error: true | |
# Create release | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: binary | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Deploy to surge | |
- name: Deploy site | |
uses: dswistowski/surge-sh-action@v1 | |
with: | |
domain: ${{ secrets.SURGE_SITE }} | |
project: folder | |
login: ${{ secrets.SURGE_LOGIN }} | |
token: ${{ secrets.SURGE_TOKEN }} | |
# Secrets to environment variables | |
- name: Setup env | |
run: echo "$(echo '${{ toJSON(secrets) }}' | jq -r 'to_entries[]|"\(.key)=\(.value)"')" >> $GITHUB_ENV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment