Skip to content

Commit

Permalink
GitHub actions (#790)
Browse files Browse the repository at this point in the history
* GitHub Action for Running Test 1

* GitHub Action for Running Test 2

* Add postgres install action

* Add postgres as a service

* Add postgres as a service 2

* Add postgres as a service 4

* Add postgres as a service 5

* Add postgres as a service 6

* Add postgres as a service 7

* Add postgres as a service 8

* Add postgres as a service 9

* Add postgres as a service 10

* Add postgres as a service 11

* Add postgres as a service 12

* Add postgres as a service 13

* Add postgres as a service 14

* Add postgres as a service 15

* Add postgres as a service 16

* Try with newer browser install step

* Delete manifest.yml

* Try with newer browser install step 2

* Try with newer browser install step 3

* Try with newer browser install step 4

* Try with newer browser install step 5

---------

Co-authored-by: Xavier Metichecchia <XavierMetichecchia>
  • Loading branch information
XavierMetichecchia authored Feb 16, 2024
1 parent e38a5a3 commit 33536cc
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 1 deletion.
98 changes: 98 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# deploy.yml test
name: Deploy analytics-reporter to cloud.gov

on:
push:
branches:
- github_actions

jobs:
Run-tests:

runs-on: ubuntu-latest

#Use environment name based on branch name
environment: ${{ github.head_ref || github.ref_name }}

#Spin up postgres as a service, wait till healthy before moving on. Uses latest Postgres Version.
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: analytics_reporter_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Code Checkout
uses: actions/checkout@v4

#Install latest LTS version of node.
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'

- name: Install Latest Firefox
run: |
sudo apt-get remove -y firefox
wget -O FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
tar xjf FirefoxSetup.tar.bz2 -C /opt/
sudo ln -s /opt/firefox/firefox /usr/bin/firefox
- name: Install Latest Chrome
run: |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get install -f
# - name: Install Firefox
# uses: browser-actions/[email protected]
# with:
# firefox-version: latest
#
# - name: Install Chrome
# uses: browser-actions/[email protected]
# with:
# chrome-version: latest
#
# - name: Install Browsers
# uses: abhi1693/[email protected]
# with:
# browser: chrome, firefox
# version: latest

- name: Create Checksum of package.json
run: echo PACKAGE_CHECKSUM="$(shasum package.json | awk '{ print $1 }')" >> "$GITHUB_ENV"

- name: Restore Cache
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: v1-dependencies-${{ env.PACKAGE_CHECKSUM }}

- name: Install Dependencies
run: npm install

- name: Save Cache
uses: actions/cache/save@v4
id: cache
with:
path: ./node_modules
key: v1-dependencies-${{ env.PACKAGE_CHECKSUM }}

- name: Run Tests
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: analytics_reporter_test
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
run: npm test
2 changes: 1 addition & 1 deletion knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
test: {
client: 'postgresql',
connection: {
host: '127.0.0.1',
host: 'localhost',
database: "analytics_reporter_test",
user: process.env.CIRCLECI ? "postgres" : config.postgres.user,
password: process.env.POSTGRES_PASSWORD,
Expand Down

0 comments on commit 33536cc

Please sign in to comment.