Skip to content

Commit

Permalink
Add initial caching to Github Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeckman314 committed Sep 20, 2024
1 parent f8db3a5 commit b127fa1
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 22 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Funnel Build and Cache

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Check out code
uses: actions/checkout@v2

- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Cache Funnel binary
uses: actions/cache@v3
with:
path: ./funnel # Path to the Funnel executable
key: ${{ runner.os }}-funnel-bin-${{ hashFiles('**/go.sum') }}

- name: Build Funnel (only if cache doesn't exist)
run: |
if [ ! -f ./funnel ]; then
make build
fi
- name: Cache Funnel binary (after build)
uses: actions/cache@v3
with:
path: funnel/
key: ${{ runner.os }}-funnel-bin-${{ hashFiles('**/go.sum') }}

- name: Upload Funnel binary as artifact (optional)
uses: actions/upload-artifact@v4
with:
name: funnelBin
path: funnel/
17 changes: 16 additions & 1 deletion .github/workflows/compliance-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ name: Compliance Test

on:
push:
branches:
- main

jobs:
build:
Expand Down Expand Up @@ -53,7 +55,8 @@ jobs:
matrix:
version: [1.0.0, 1.1.0]
db: ["boltdb", "mongodb"]
compute: ["local"]
compute: ["local", "kubernetes"]
storage: ["local", "s3"]
needs: build
runs-on: ubuntu-latest
steps:
Expand All @@ -69,10 +72,22 @@ jobs:
- name: Start Funnel server
run: |
touch config.yml
if [ ${{ matrix.db }} = "mongodb" ]; then
make start-mongodb
cat `pwd`/tests/mongo.config.yml >> config.yml
fi
if [ ${{ matrix.storage }} = "s3" ]; then
docker run -d -p 9000:9000 --name minio \
-e "MINIO_ROOT_USER=minioadmin" \
-e "MINIO_ROOT_PASSWORD=minioadmin" \
-v /tmp/data:/data \
-v /tmp/config:/root/.minio \
minio/minio server /data
cat `pwd`/tests/s3.config.yml >> config.yml
fi
chmod +x funnel
./funnel server run --config `pwd`/config.yml &> funnel.logs &
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Funnel Use Workflow

on:
workflow_run:
workflows: ["Funnel Build and Cache"] # Name of the build workflow
types:
- completed

jobs:
use-funnel:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Check out code
uses: actions/checkout@v2

- name: Cache Funnel binary
uses: actions/cache@v3
with:
path: funnel/
key: ${{ runner.os }}-funnel-bin-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-funnel-bin-
- name: Use Funnel binary
run: |
if [ -f ./funnel/funnel ]; then
echo "Using cached Funnel binary"
chmod +x ./funnel/funnel
./funnel/funnel server --LocalStorage.AllowedDirs $HOME run &
else
echo "Funnel binary not found. Exiting."
exit 1
fi
24 changes: 3 additions & 21 deletions .github/workflows/nextflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,13 @@ name: Nextflow Test

on:
push:
branches:
- main


jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Check out code
uses: actions/checkout@v2

- name: Build Funnel (if cache does not exist)
run: make build

- name: Store Funnel
uses: actions/upload-artifact@v4
with:
name: funnelBin
path: funnel

nextflow:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Funnel
uses: actions/download-artifact@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/s3-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ name: S3 Integration Test

on:
push:
branches:
- main

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Go Tests

on:
push:
branches:
- main

jobs:
# Temporarily disabling linting
Expand Down

0 comments on commit b127fa1

Please sign in to comment.