Skip to content

Commit

Permalink
Use HAS_CODECOV_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleJune committed Jul 30, 2023
1 parent 5341797 commit 1248e89
Showing 1 changed file with 7 additions and 29 deletions.
36 changes: 7 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,16 @@ jobs:
runs-on: ubuntu-latest
outputs:
DENO_DIR: ${{ steps.deno-dir.outputs.DENO_DIR }}
HAS_CODECOV_TOKEN: ${{ steps.secrets.outputs.CODECOV_TOKEN }}
HAS_CODECOV_TOKEN: ${{ steps.secrets.outputs.HAS_CODECOV_TOKEN }}
steps:
- id: deno-dir
name: Get cache directory
run: |
echo "DENO_DIR=${{ runner.temp }}/deno_dir" >> $GITHUB_OUTPUT;
- id: secrets
name: Get secrets
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
name: Check secrets
run: |
if [ "${{ secrets.CODECOV_TOKEN }}" != "" ]
then
echo "Has codecov";
echo "CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}" >> $GITHUB_OUTPUT;
else
echo "does not have codecov";
fi
echo "HAS_CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN != '' }}" >> $GITHUB_OUTPUT;
lint:
name: Lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -86,20 +78,6 @@ jobs:
APP_ENV: test
DENO_DIR: ${{ needs.variables.outputs.DENO_DIR }}
steps:
- id: variables
name: Test variables
run: |
echo "Hello World!";
echo "DENO_DIR from variables = ${{ needs.variables.outputs.DENO_DIR }}";
echo "DENO_DIR from variables = ${{ needs.variables.outputs.DENO_DIR != '' }}";
echo "DENO_DIR from env = ${{ env.DENO_DIR }}";
echo "DENO_DIR from env = ${{ env.DENO_DIR != '' }}";
echo "CODECOV_TOKEN from variables = ${{ needs.variables.outputs.CODECOV_TOKEN }}";
echo "CODECOV_TOKEN from variables = ${{ needs.variables.outputs.CODECOV_TOKEN != '' }}";
echo "CODECOV_TOKEN from secrets = ${{ secrets.CODECOV_TOKEN }}";
echo "CODECOV_TOKEN from secrets = ${{ secrets.CODECOV_TOKEN != '' }}";
echo "FAKE from secrets = ${{ secrets.FAKE }}";
echo "FAKE from secrets = ${{ secrets.FAKE != '' }}";
- name: Clone repository
uses: actions/[email protected]
- name: Setup deno
Expand All @@ -119,19 +97,19 @@ jobs:
working-directory: ${{ inputs.working-directory }}
if: |
matrix.os != 'ubuntu-latest'
|| needs.variables.outputs.CODECOV_TOKEN == ''
|| needs.variables.outputs.HAS_CODECOV_TOKEN == 'true'
run: deno test ${{ inputs.test-args }} .
- name: Run tests and collect coverage
working-directory: ${{ inputs.working-directory }}
if: |
matrix.os == 'ubuntu-latest'
&& needs.variables.outputs.CODECOV_TOKEN != ''
&& needs.variables.outputs.HAS_CODECOV_TOKEN == 'false'
run: deno test --coverage=cov ${{ inputs.test-args }} .
- name: Generate coverage
working-directory: ${{ inputs.working-directory }}
if: |
matrix.os == 'ubuntu-latest'
&& needs.variables.outputs.CODECOV_TOKEN != ''
&& needs.variables.outputs.HAS_CODECOV_TOKEN == 'false'
run: deno coverage --lcov ${{ inputs.test-args }} > cov.lcov
- name: Upload coverage
uses: codecov/codecov-action@v3
Expand All @@ -141,4 +119,4 @@ jobs:
fail_ci_if_error: true
if: |
matrix.os == 'ubuntu-latest'
&& needs.variables.outputs.CODECOV_TOKEN
&& needs.variables.outputs.HAS_CODECOV_TOKEN == 'true'

0 comments on commit 1248e89

Please sign in to comment.