Skip to content

Commit

Permalink
ci: github actions: use runner.temp instead of hardcoded /tmp (dagger…
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonsteiner authored Jan 7, 2025
1 parent d5a67f2 commit 6e652c2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 30 deletions.
25 changes: 10 additions & 15 deletions .github/actions/call/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ runs:
- name: Setup
shell: bash
run: |
mkdir -p /tmp/actions/call
touch /tmp/actions/call/local-envs
mkdir -p ${{ runner.temp }}/actions/call
touch ${{ runner.temp }}/actions/call/local-envs
- name: Install dagger
shell: bash
Expand Down Expand Up @@ -76,9 +76,9 @@ runs:
exit 1
fi
# put env variables in /tmp/actions/call/local-envs instead of
# put env variables in ${{ runner.temp }}/actions/call/local-envs instead of
# $GITHUB_ENV to avoid leaking into parent workflow
(cd .dagger/mage; go run main.go -w ../.. engine:dev) | tee /tmp/actions/call/local-envs
(cd .dagger/mage; go run main.go -w ../.. engine:dev) | tee ${{ runner.temp }}/actions/call/local-envs
echo "::endgroup::"
env:
Expand All @@ -91,7 +91,7 @@ runs:
- name: Wait for dagger to be ready
shell: bash
run: |
source /tmp/actions/call/local-envs
source ${{ runner.temp }}/actions/call/local-envs
echo "::group::Dagger client version"
dagger --silent version
Expand All @@ -104,11 +104,11 @@ runs:
- name: ${{ inputs.function }}
shell: bash
run: |
source /tmp/actions/call/local-envs
source ${{ runner.temp }}/actions/call/local-envs
function redirect_logs() {
if [[ "${{ inputs.upload-logs }}" == "true" ]]; then
"$@" &> /tmp/actions/call/call.log
"$@" &> ${{ runner.temp }}/actions/call/call.log
elif [[ -n "${{ inputs.redirect }}" ]]; then
"$@" | tee "${{ inputs.redirect }}"
else
Expand All @@ -135,24 +135,19 @@ runs:
uses: actions/upload-artifact@v4
with:
name: call-logs-${{ runner.name }}-${{ github.job }}
path: /tmp/actions/call/call.log
path: ${{ runner.temp }}/actions/call/call.log
overwrite: true

- name: Capture dev engine logs
if: always() && inputs.dev-engine == 'true'
shell: bash
run: |
docker logs dagger-engine.dev-${{ runner.name }} &> /tmp/actions/call/engine.log
docker logs dagger-engine.dev-${{ runner.name }} &> ${{ runner.temp }}/actions/call/engine.log
- name: Archive engine logs
if: always() && inputs.dev-engine == 'true'
uses: actions/upload-artifact@v4
with:
name: engine-logs-${{ runner.name }}
path: /tmp/actions/call/engine.log
path: ${{ runner.temp }}/actions/call/engine.log
overwrite: true

- name: Cleanup
shell: bash
run: |
rm -rf /tmp/actions/call
31 changes: 16 additions & 15 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,23 @@ jobs:
- name: dagger init (go)
shell: bash
run: |
mkdir -p /tmp/benchmark
cd /tmp/benchmark
mkdir -p ${{ runner.temp }}/benchmark
cd ${{ runner.temp }}/benchmark
dagger init --name=benchmark --sdk=go
- name: dagger functions@initial (go)
shell: bash
run: |
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

- name: dagger functions@cached (go)
shell: bash
run: |
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

- name: dagger functions@modified (go)
shell: bash
Expand All @@ -52,7 +53,7 @@ jobs:
[ -f "main.go" ] && echo >> main.go
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

benchmark-python:
name: Benchmark (Python)
Expand All @@ -65,22 +66,22 @@ jobs:
- name: dagger init (python)
shell: bash
run: |
mkdir -p /tmp/benchmark
cd /tmp/benchmark
mkdir -p ${{ runner.temp }}/benchmark
cd ${{ runner.temp }}/benchmark
dagger init --name=benchmark --sdk=python
- name: dagger functions@initial (python)
shell: bash
run: |
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

- name: dagger functions@cached (python)
shell: bash
run: |
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

- name: dagger functions@modified (python)
shell: bash
Expand All @@ -89,7 +90,7 @@ jobs:
[ -f "src/main/__init__.py" ] && echo >> src/main/__init__.py
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

benchmark-typescript:
name: Benchmark (TypeScript::${{ matrix.package-manager }})
Expand All @@ -106,8 +107,8 @@ jobs:
- name: dagger init (typescript::${{ matrix.package-manager }})
shell: bash
run: |
mkdir -p /tmp/benchmark
cd /tmp/benchmark
mkdir -p ${{ runner.temp }}/benchmark
cd ${{ runner.temp }}/benchmark
if [ "${{ matrix.package-manager }}" == "pnpm" ]; then
cat << EOF > package.json
Expand Down Expand Up @@ -182,13 +183,13 @@ jobs:
shell: bash
run: |
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

- name: dagger functions@cached (typescript::${{ matrix.package-manager }})
shell: bash
run: |
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

- name: dagger functions@modified (typescript::${{ matrix.package-manager }})
shell: bash
Expand All @@ -197,4 +198,4 @@ jobs:
[ -f "src/index.ts" ] && echo >> src/index.ts
dagger functions
working-directory: /tmp/benchmark
working-directory: ${{ runner.temp }}/benchmark

0 comments on commit 6e652c2

Please sign in to comment.