Fix | Use compose action #85
Workflow file for this run
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: Lint And Test | |
on: | |
pull_request: | |
branches: [master] | |
push: | |
branches: [master] | |
jobs: | |
verify_lint: | |
name: Verify lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Use node 16 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
# Install deps from lockfile | |
run: npm ci | |
# Run lint | |
- name: Lint | |
run: npm run lint | |
run_tests_and_push_to_codecov: | |
# Name with matrix eval | |
runs-on: ubuntu-latest | |
needs: verify_lint | |
strategy: | |
matrix: | |
# We verify compatibility for current and previous LTS | |
node_version: [16, 18] | |
name: "[ Node ${{ matrix.node_version }} ] Run tests and push to codecov" | |
env: | |
NODE_VERSION: ${{ matrix.node_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Fetch all history for all tags and branches | |
fetch-depth: 0 | |
- name: Build the stack | |
uses: hoverkraft-tech/compose-action@v2.0.1 | |
with: | |
compose-file: "./docker-compose.yml" | |
- name: Build testing container | |
run: docker build -t tests:${{ github.sha }} --build-arg SET_NODE_VERSION=$NODE_VERSION . | |
- name: Invoke testing container | |
run: docker run --network vault-network | |
-e VAULT_ADDR=$VAULT_ADDR | |
-v $PWD/coverage:/app/coverage tests:${{ github.sha }} "cd /app && npm run coverage" | |
env: | |
VAULT_ADDR: http://vault:8200 | |
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # tag: 3.1.4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
env_vars: NODE_VERSION # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) |