From c0521e66ae85ef247c16e9f6ff1de0906c5ce42c Mon Sep 17 00:00:00 2001 From: tristan-greffe Date: Sat, 9 Dec 2023 16:59:41 +0100 Subject: [PATCH] wip: migration from Travis CI to GitHub Actions #149 --- .github/workflows/build.sh | 9 ++++++--- .github/workflows/env.sh | 5 ++++- .github/workflows/main.yml | 7 ++++--- .github/workflows/test.sh | 6 +++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh index 03591015..fb5e1d4c 100644 --- a/.github/workflows/build.sh +++ b/.github/workflows/build.sh @@ -1,8 +1,5 @@ #!/bin/bash -chmod +x ./.github/workflows/env.sh -./.github/workflows/env.sh - check_code() { if [[ $1 -ne $2 ]]; then @@ -11,6 +8,12 @@ check_code() fi } +# +# Provision the required files +# +chmod +x ./.github/workflows/env.sh +./.github/workflows/env.sh + # # Build the app # diff --git a/.github/workflows/env.sh b/.github/workflows/env.sh index bf11c18e..bc75133a 100644 --- a/.github/workflows/env.sh +++ b/.github/workflows/env.sh @@ -10,6 +10,7 @@ parse_semver() # # Provision the required files # +echo "##[group]Provision" # Define the application name APP=$(node -p -e "require('./package.json').name") @@ -70,4 +71,6 @@ fi # Clone the project and install the dependencies node . $APP.js --clone node . $APP.js --install -node . $APP.js --link \ No newline at end of file +node . $APP.js --link + +echo "##[endgroup]" \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16b0d61b..a91c3a1b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,13 @@ name: Build & Deploy on: [push] +env: + TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }} jobs: test: if: ${{ !contains(github.event.head_commit.message, '[skip test]') }} runs-on: ubuntu-latest - env: + env: DB_URL: "mongodb://mongo:27017" steps: - uses: actions/checkout@v4 @@ -23,10 +25,9 @@ jobs: build: if: ${{ !contains(github.event.head_commit.message, '[skip app]') }} runs-on: ubuntu-latest - env: + env: DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }} steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 diff --git a/.github/workflows/test.sh b/.github/workflows/test.sh index f29cc177..19be1e13 100644 --- a/.github/workflows/test.sh +++ b/.github/workflows/test.sh @@ -1,9 +1,13 @@ echo "Running tests" +# +# Provision the required files +# chmod +x ./.github/workflows/env.sh ./.github/workflows/env.sh +# # Run backend tests +# cd api -yarn yarn test