Mock API Server #49
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: Mock API Server | |
on: | |
schedule: | |
- cron: '00 20 * * *' | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
Mock-API-Node-AMD64: | |
strategy: | |
matrix: | |
nv: ["14", "16", "17", "18", "19"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build the Docker image Nodejs ${{ matrix.nv }} | |
run: docker-compose -f "docker-compose.yml" up -d --build | |
env: | |
NODEJS_VERSION: ${{ matrix.nv }} | |
APP_CODE_PATH_HOST: /tmp/app/ | |
- name: Node and NPM version check | |
run: | | |
docker exec mock-api-server_nodejs_1 node -v | |
docker exec mock-api-server_nodejs_1 npm -v | |
- name: API checking | |
run: | | |
sleep 30s | |
curl -i http://localhost:3000/v1/users | |
- name: Destroy container and file | |
run: | | |
docker-compose down | |
sudo rm -rf /tmp/app/ | |
echo "y" | docker image prune -a | |
- name: Create ENV | |
env: | |
ENV_TEST: ${{ secrets.ENV_TEST }} | |
run: | | |
echo "$ENV_TEST" > .env.test | |
shell: bash | |
- name: Notify on SUCCESS | |
if: ${{ SUCCESS() }} | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
notification_title: "{emoji} *{job}* has {status_message}" | |
message_format: "*{workflow}* {status_message} in <{branch_url}|{branch}> Architecture <{run_url}|{job}> Approved by ${{ github.event.head_commit.author.name }}" | |
footer: "Linked Repo <{repo_url}|{repo}>" | |
mention_users: "D056LFW47NF," | |
mention_users_when: "SUCCESS" | |
mention_groups: "C06H0SB11JL" | |
mention_groups_when: "SUCCESS" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_SUCCESS }} | |
- name: Notify on FAIL | |
if: ${{ failure() }} | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
notification_title: "{emoji} *{job}* has {status_message}" | |
message_format: "*{workflow}* {status_message} in <{branch_url}|{branch}> Architecture <{run_url}|{job}> Approved by ${{ github.event.head_commit.author.name }}" | |
footer: "Linked Repo <{repo_url}|{repo}>" | |
mention_users: "D056LFW47NF" | |
mention_users_when: "failure,warnings" | |
mention_groups: "C06G95T1YH3" | |
mention_groups_when: "failure,warnings" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FAIL }} | |
Mock-API-Node-ARM64: | |
strategy: | |
matrix: | |
nv: ["14", "16", "17", "18", "19"] | |
runs-on: ubuntu-22.04 | |
name: Mock-API-Node-ARM64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Run commands | |
id: runcmd | |
with: | |
arch: aarch64 | |
distro: ubuntu22.04 | |
run: | | |
uname -a | |
echo ::set-output name=uname::$(uname -a) | |
- name: Get the output | |
run: | | |
echo "The uname output was ${{ steps.runcmd.outputs.uname }}" | |
- name: Build the Docker image Nodejs ${{ matrix.nv }} | |
run: docker-compose -f "docker-compose.yml" up -d --build | |
env: | |
NODEJS_VERSION: ${{ matrix.nv }} | |
APP_CODE_PATH_HOST: /tmp/app/ | |
- name: Node and NPM version check | |
run: | | |
docker exec mock-api-server_nodejs_1 node -v | |
docker exec mock-api-server_nodejs_1 npm -v | |
- name: API checking | |
run: | | |
sleep 30s | |
curl -i http://localhost:3000/v1/users | |
- name: Destroy container and file | |
run: | | |
docker-compose down | |
sudo rm -rf /tmp/app/ | |
echo "y" | docker image prune -a | |
- name: Create ENV | |
env: | |
ENV_TEST: ${{ secrets.ENV_TEST }} | |
run: | | |
echo "$ENV_TEST" > .env.test | |
shell: bash | |
- name: Notify on SUCCESS | |
if: ${{ SUCCESS() }} | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
notification_title: "{emoji} *{job}* has {status_message}" | |
message_format: "*{workflow}* {status_message} in <{branch_url}|{branch}> Architecture <{run_url}|{job}> Approved by ${{ github.event.head_commit.author.name }}" | |
footer: "Linked Repo <{repo_url}|{repo}>" | |
mention_users: "D056LFW47NF," | |
mention_users_when: "SUCCESS" | |
mention_groups: "C06H0SB11JL" | |
mention_groups_when: "SUCCESS" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_SUCCESS }} | |
- name: Notify on FAIL | |
if: ${{ failure() }} | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
notification_title: "{emoji} *{job}* has {status_message}" | |
message_format: "*{workflow}* {status_message} in <{branch_url}|{branch}> Architecture <{run_url}|{job}> Approved by ${{ github.event.head_commit.author.name }}" | |
footer: "Linked Repo <{repo_url}|{repo}>" | |
mention_users: "D056LFW47NF" | |
mention_users_when: "failure,warnings" | |
mention_groups: "C06G95T1YH3" | |
mention_groups_when: "failure,warnings" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FAIL }} |