Skip to content

Commit

Permalink
Cleanup workflows
Browse files Browse the repository at this point in the history
* Remove legacies and useless steps
* Consitent step and host naming
* Bump versions to avoid node-16

Signed-off-by: Benoit Donneaux <benoit@leastauthority.com>
  • Loading branch information
btlogy committed Feb 2, 2024
1 parent 35c770c commit 0a3ea51
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 61 deletions.
59 changes: 16 additions & 43 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,28 @@ on:
- stage
- prod
required: true
# workflow_run:
# workflows: [transfer-repo-CI]
# types: [completed]
# branches: [main]

jobs:
deploy:
# `if` required because a workflow run is triggered regardless of
# the result of the previous workflow (see the documentation page)
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Deploy
runs-on: ubuntu-22.04
env:
TEST_ENV: foobar
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

- name: setup npm, yarn etc.
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install docker and docker-compose
run: |
sudo curl -o /usr/local/bin/docker-compose -L \
"https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64"
sudo chmod +x /usr/local/bin/docker-compose
- name: create variables for production env.
if: inputs.environment == 'prod'
run: |
echo "MAILBOX_URL=wss://mailbox.winden.app/v1" >> $GITHUB_ENV
echo "RELAY_URL=wss://relay.winden.app/" >> $GITHUB_ENV
- name: create variables for stage env.
if: inputs.environment == 'stage'
run: |
echo "MAILBOX_URL=wss://mailbox.stage.winden.app/v1" >> $GITHUB_ENV
echo "RELAY_URL=wss://relay.stage.winden.app/" >> $GITHUB_ENV
- name: create config .env file
- name: Prepare environment
run: |
touch ./client/.env
if [ "${{ inputs.environment }}" = "prod" ]; then
echo "MAILBOX_URL=wss://mailbox.winden.app/v1" >> ./client/.env
echo "RELAY_URL=wss://relay.winden.app/" >> ./client/.env
else
echo "MAILBOX_URL=wss://mailbox.stage.winden.app/v1" >> ./client/.env
echo "RELAY_URL=wss://relay.stage.winden.app/" >> ./client/.env
fi
cat <<EOF >> ./client/.env
MAILBOX_URL="${{ env.MAILBOX_URL }}"
RELAY_URL="${{ env.RELAY_URL }}"
SFTP_HOSTNAME=${{ secrets.SFTP_HOSTNAME }}
SFTP_USERNAME=${{ secrets.SFTP_USERNAME }}
SFTP_IDENTITY="${{ secrets.SFTP_IDENTITY }}"
Expand All @@ -68,13 +41,13 @@ jobs:
EOF
touch ./client-e2e/.env
- name: prepare
- name: Prepare containers
run: |
docker-compose build --build-arg uid="$(id -u)" --build-arg gid="$(id -g)"
docker-compose run client npm i
docker compose build --build-arg uid="$(id -u)" --build-arg gid="$(id -g)"
docker compose run client npm i
- name: deploy
run: docker-compose run client npm run deploy
- name: Deploy application
run: docker compose run client npm run deploy

- name: tear down
run: docker-compose down
- name: Stop containers
run: docker compose down
25 changes: 7 additions & 18 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "same_content_newer"
paths: '["client/**", "client-e2e/**", ".github/workflows/integrate.yml"]'
paths: '["docker-compose.yml", "client/**", "client-e2e/**", ".github/workflows/integrate.yml"]'

build:
name: Build/Test
Expand All @@ -38,22 +38,12 @@ jobs:
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Setup npm, yarn etc.
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install docker and docker-compose
run: |
sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64"
sudo chmod +x /usr/local/bin/docker-compose
- name: Setup for running tests
- name: Prepare environment
run: |
IP=$(ip address show eth0 | grep inet | cut -d ' ' -f 6 | cut -d '/' -f1 | head -n1)
printf "HOST_IP address is: %s\n" "$IP"
Expand All @@ -62,22 +52,22 @@ jobs:
EOF
cat <<EOF >> ./client/.env
NODE_ENV=development
MAILBOX_URL="wss://mailbox.stage.mw.leastauthority.com/v1"
RELAY_URL="wss://relay.stage.mw.leastauthority.com"
MAILBOX_URL="wss://mailbox.stage.mw.winden.app/v1"
RELAY_URL="wss://relay.stage.mw.windent.app"
EOF
printf "Client .env:\n"
cat ./client/.env
printf "Client-e2e .env:\n"
cat ./.env
- name: Set up containers
- name: Prepare containers
run: |
docker compose -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e build --build-arg uid="$(id -u)" --build-arg gid="$(id -g)"
docker compose run --rm client npm i
docker compose run --rm client ./scripts/setup.sh
docker compose -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e run --rm client-e2e npm i
- name: Start up devserver
- name: Start devserver
run: |
docker compose up -d client
docker compose exec client ./scripts/wait-for-webpack.sh
Expand All @@ -97,7 +87,6 @@ jobs:
run: docker compose -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e down

- uses: sonarsource/sonarqube-scan-action@master
# if: github.ref_name == 'main' && github.event_name == 'push'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

0 comments on commit 0a3ea51

Please sign in to comment.