Skip to content

Commit

Permalink
updates workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Oct 30, 2023
1 parent 3b94361 commit f297336
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 68 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/cacher-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@ jobs:
run: npm ci

- name: run cacher tests
env:
NODE_PATH: /home/runner/work/Blot/Blot/app
BLOT_OPENRESTY_TEST_USER: runner
BLOT_OPENRESTY_TEST_GROUP: runner
run: |
npm test config/openresty/conf/cacher/tests/index.js
130 changes: 65 additions & 65 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -18,72 +18,72 @@ jobs:
redis-version: [6.2.6]

environment: Tests

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Pandoc
if: steps.pandoc.outputs.cache-hit != 'true'
run: |
wget https://github.com/jgm/pandoc/releases/download/${{ matrix.pandoc-version }}/pandoc-${{ matrix.pandoc-version }}-linux-amd64.tar.gz -O pandoc.tar.gz
mkdir pandoc
tar xvzf pandoc.tar.gz --strip-components 1 -C pandoc
echo "$(pwd)/pandoc/bin" >> $GITHUB_PATH
- name: Set up Pandoc
if: steps.pandoc.outputs.cache-hit != 'true'
run: |
wget https://github.com/jgm/pandoc/releases/download/${{ matrix.pandoc-version }}/pandoc-${{ matrix.pandoc-version }}-linux-amd64.tar.gz -O pandoc.tar.gz
mkdir pandoc
tar xvzf pandoc.tar.gz --strip-components 1 -C pandoc
echo "$(pwd)/pandoc/bin" >> $GITHUB_PATH
- name: Source pandoc
run: echo "BLOT_PANDOC_PATH=$(which pandoc)" >> $GITHUB_ENV

- name: Source pandoc
run: echo "BLOT_PANDOC_PATH=$(which pandoc)" >> $GITHUB_ENV
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up Redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: ${{ matrix.redis-version }}

- name: Set up Redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: ${{ matrix.redis-version }}
- name: Load dependencies
uses: actions/cache@v2
id: cache-node-dependencies
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Load dependencies
uses: actions/cache@v2
id: cache-node-dependencies
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install Dependencies
if: steps.cache-node-dependencies.outputs.cache-hit != 'true'
env:
PUPETEER_PRODUCT: firefox
run: npm ci
- name: Install Dependencies
if: steps.cache-node-dependencies.outputs.cache-hit != 'true'
env:
PUPETEER_PRODUCT: firefox
run: npm ci

- name: Run tests
env:
BLOT_CACHE: false
BLOT_DIRECTORY: /home/runner/work/Blot/Blot
NODE_PATH: /home/runner/work/Blot/Blot/app
BLOT_CACHE_DIRECTORY: /home/runner/work/Blot/Blot/cache
BLOT_DEBUG: false
BLOT_MAINTENANCE: false
BLOT_PRODUCTION: true
BLOT_PROTOCOL: https
BLOT_ENVIRONMENT: production
BLOT_HOST: blot.development
BLOT_ADMIN_EMAIL: ${{ secrets.BLOT_ADMIN_EMAIL }}
BLOT_DROPBOX_APP_SECRET: ${{ secrets.BLOT_DROPBOX_APP_SECRET }}
BLOT_DROPBOX_FULL_SECRET: ${{ secrets.BLOT_DROPBOX_FULL_SECRET }}
BLOT_DROPBOX_TEST_ACCOUNT_APP_TOKEN: ${{ secrets.BLOT_DROPBOX_TEST_ACCOUNT_APP_TOKEN }}
BLOT_DROPBOX_TEST_ACCOUNT_FULL_TOKEN: ${{ secrets.BLOT_DROPBOX_TEST_ACCOUNT_FULL_TOKEN }}
BLOT_DROPBOX_TEST_ACCOUNT_ID: ${{ secrets.BLOT_DROPBOX_TEST_ACCOUNT_ID }}
BLOT_MAILGUN_KEY: ${{ secrets.BLOT_MAILGUN_KEY }}
BLOT_SESSION_SECRET: ${{ secrets.BLOT_SESSION_SECRET }}
BLOT_TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.BLOT_TWITTER_ACCESS_TOKEN_KEY }}
BLOT_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.BLOT_TWITTER_ACCESS_TOKEN_SECRET }}
BLOT_TWITTER_CONSUMER_KEY: ${{ secrets.BLOT_TWITTER_CONSUMER_KEY }}
BLOT_TWITTER_CONSUMER_SECRET: ${{ secrets.BLOT_TWITTER_CONSUMER_SECRET }}
BLOT_REDIS_HOST: 127.0.0.1
run: |
git config --global user.email "admin@example.com"
git config --global user.name "Admin"
node app/setup
npm test
- name: Run tests
env:
BLOT_CACHE: false
BLOT_DIRECTORY: /home/runner/work/Blot/Blot
NODE_PATH: /home/runner/work/Blot/Blot/app
BLOT_CACHE_DIRECTORY: /home/runner/work/Blot/Blot/cache
BLOT_DEBUG: false
BLOT_MAINTENANCE: false
BLOT_PRODUCTION: true
BLOT_PROTOCOL: https
BLOT_ENVIRONMENT: production
BLOT_HOST: blot.development
BLOT_ADMIN_EMAIL: ${{ secrets.BLOT_ADMIN_EMAIL }}
BLOT_DROPBOX_APP_SECRET: ${{ secrets.BLOT_DROPBOX_APP_SECRET }}
BLOT_DROPBOX_FULL_SECRET: ${{ secrets.BLOT_DROPBOX_FULL_SECRET }}
BLOT_DROPBOX_TEST_ACCOUNT_APP_TOKEN: ${{ secrets.BLOT_DROPBOX_TEST_ACCOUNT_APP_TOKEN }}
BLOT_DROPBOX_TEST_ACCOUNT_FULL_TOKEN: ${{ secrets.BLOT_DROPBOX_TEST_ACCOUNT_FULL_TOKEN }}
BLOT_DROPBOX_TEST_ACCOUNT_ID: ${{ secrets.BLOT_DROPBOX_TEST_ACCOUNT_ID }}
BLOT_MAILGUN_KEY: ${{ secrets.BLOT_MAILGUN_KEY }}
BLOT_SESSION_SECRET: ${{ secrets.BLOT_SESSION_SECRET }}
BLOT_TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.BLOT_TWITTER_ACCESS_TOKEN_KEY }}
BLOT_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.BLOT_TWITTER_ACCESS_TOKEN_SECRET }}
BLOT_TWITTER_CONSUMER_KEY: ${{ secrets.BLOT_TWITTER_CONSUMER_KEY }}
BLOT_TWITTER_CONSUMER_SECRET: ${{ secrets.BLOT_TWITTER_CONSUMER_SECRET }}
BLOT_REDIS_HOST: 127.0.0.1
run: |
git config --global user.email "admin@example.com"
git config --global user.name "Admin"
node app/setup
npm test
16 changes: 13 additions & 3 deletions config/openresty/conf/cacher/tests/start-openresty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ if [ -z "$PIDS" ]; then
echo "No nginx processes running"
else

# for each PID, kill it
for PID in $PIDS
# for each PID, kill it
for PID in $PIDS
do
echo "Killing nginx process $PID"
sudo kill -9 $PID
done
fi

sudo openresty -c $1
# determine the path to the openresty executable
# on my mac it will be present in the PATH already, but on github actions
# we need to use: /usr/local/openresty/bin/openresty
OPENRESTY=$(which openresty)

if [ -z "$OPENRESTY" ]; then
OPENRESTY="/usr/local/openresty/bin/openresty"
exit 1
fi

sudo $OPENRESTY -c $1

0 comments on commit f297336

Please sign in to comment.