Skip to content

Commit

Permalink
fix(continuous-integration): support relative non-glob build path
Browse files Browse the repository at this point in the history
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
  • Loading branch information
neilime committed Apr 9, 2024
1 parent 0b95c88 commit d0eb641
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/__test-workflow-continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,25 @@ permissions:
id-token: write

jobs:
tests:
act:
name: Act - Run the continuous integration workflow
uses: ./.github/workflows/continuous-integration.yml
with:
build: |
{
"artifact": "dist"
}
assert:
name: Assert - Ensure build artifact has been uploaded
runs-on: ubuntu-latest
needs: act
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: "/"

- name: Check the build artifacts
run: test -f dist/index.html
13 changes: 3 additions & 10 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,11 @@ jobs:
.map(artifact => artifact.trim())
.filter(Boolean)
.map(artifact => {
if (!artifact.includes('*')) {
if (artifact.startsWith('/')) {
return artifact;
}
return `${{ github.workspace }}/${artifact}`;
}
// FIXME: Workaround to preserve full path to artifact
const fullpath = artifact.startsWith('/') ? artifact : `${{ github.workspace }}/${artifact}`;
// Add a wildcard to the first folder of the path
const workspace = `${{ github.workspace }}`.replace(/\/([^/]+)/, '/*$1');
return `${workspace}/${artifact}`;
return fullpath.replace(/\/([^/]+)/, '/*$1');
});
core.setOutput('artifact', sanitizedArtifacts.join('\n'));
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
/node_modules
/dist
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "test-for-ci",
"scripts": {
"lint": "echo \"lint test\"",
"build": "echo \"build test\"",
"build": "mkdir -p dist && echo \"build test\" > dist/test.txt",
"test:ci": "echo \"test CI\""
},
"dependencies": {
Expand Down

0 comments on commit d0eb641

Please sign in to comment.