Merge pull request #86 from ynufes-tech/shion/file-question-image-con… #224
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
name: GoTestFirebaseEmulator | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
paths: | |
- '**.go' | |
- '.github/**' | |
jobs: | |
go-test-with-firebase-emulator: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
cache: true | |
- name: Download Go modules | |
shell: bash | |
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }} | |
run: go mod download | |
- run: | | |
echo "ENV_LOCATION=$GITHUB_WORKSPACE/pkg/setting/files/setting.testing.yaml" | |
echo "ENV_LOCATION=$GITHUB_WORKSPACE/pkg/setting/files/setting.testing.yaml" >> $GITHUB_ENV | |
- name: Install firebase-emulator | |
run: npm install -g firebase-tools | |
- name: Run Firebase Emulator | |
run: | | |
firebase setup:emulators:database | |
firebase emulators:start --only database & | |
- name: 'Waiting for the emulator to start up' | |
run: sleep 20 | |
- name: Run tests | |
env: | |
FIREBASE_DATABASE_EMULATOR_HOST: localhost:9000 | |
run: go test -p=1 -race -coverprofile=coverage.txt -covermode=atomic ./... #gosetup | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true |