File tree Expand file tree Collapse file tree 3 files changed +143
-1
lines changed
Expand file tree Collapse file tree 3 files changed +143
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Machinefile test
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ test :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v3
14+
15+ - name : Checkout Machinefile repository for test data
16+ uses : actions/checkout@v3
17+ with :
18+ repository : gbraad-redhat/Machinefile
19+ path : machinefile-test-data
20+
21+ - name : Run Machinefile commands
22+ uses : ./
23+ with :
24+ containerfile : ' machinefile-test-data/test/Machinefile'
25+ context : ' machinefile-test-data/test'
26+
27+ - name : Verify execution
28+ run : |
29+ if [ -f /tmp/hello ]; then
30+ echo "Machinefile executed successfully"
31+ cat /tmp/hello
32+ else
33+ echo "Machinefile execution failed"
34+ exit 1
35+ fi
Original file line number Diff line number Diff line change 1- # Machinefile-github-action
1+ # Machinefile GitHub Action
2+
3+
4+ This action allows you to run Dockerfile/Containerfile commands directly on the host system without using Docker or any other container engine. It's useful for executing build commands in a predictable environment or setting up development tools.
5+
6+
7+ ## Usage
8+
9+ ``` yaml
10+ steps :
11+ - uses : actions/checkout@v3
12+ - name : Run Machinefile commands
13+ uses : gbraad-redhat/machinefile-executor-action@v1
14+ with :
15+ containerfile : ' Containerfile' # or path to your Containerfile
16+ context : ' .' # Build context directory
17+ ` ` `
18+
19+ ## Inputs
20+
21+ | Input | Description | Required | Default |
22+ |---------------|------------------------------------------|----------|----------------|
23+ | containerfile | Path to the Dockerfile/Containerfile | Yes | 'Containerfile'|
24+ | context | Directory to use as build context | Yes | '.' |
25+
26+ ## Example
27+
28+ Here's an example workflow that uses the Machinefile Executor to set up a development environment:
29+
30+ ` ` ` yaml
31+ name : Build with Containerfile
32+
33+ on :
34+ push :
35+ branches : [ main ]
36+ pull_request :
37+ branches : [ main ]
38+
39+ jobs :
40+ build :
41+ runs-on : ubuntu-latest
42+ steps :
43+ - uses : actions/checkout@v3
44+
45+ - name : Run Dockerfile commands
46+ uses : gbraad-redhat/machinefile-executor-action@v1
47+ with :
48+ dockerfile : ' containers/Containerfile-devtools'
49+ context : ' .'
50+
51+ - name : Run build tests
52+ run : |
53+ # Your build commands here
54+ make test
55+ ` ` `
56+
57+
58+ ## License
59+
60+ [MIT License](LICENSE)
61+
62+
63+ ## Author
64+
65+ | [](http://gbraad.nl "Gerard Braad <me@gbraad.nl>") |
66+ |---|
67+ | [@gbraad](https://gbraad.nl/social) |
Original file line number Diff line number Diff line change 1+ name : " Machinefile executor"
2+ description : " A simple Dockerfile/Containerfile interpreter to set up the local machine"
3+ author : " Gerard Braad <me@gbraad.nl>"
4+ inputs :
5+ containerfile :
6+ description : ' Path to the Dockerfile/Containerfile to execute'
7+ required : true
8+ default : ' Containerfile'
9+ context :
10+ description : ' Directory to use as build context'
11+ required : true
12+ default : ' .'
13+ runs :
14+ using : ' composite'
15+ steps :
16+ - name : Setup Machinefile executor
17+ id : setup
18+ shell : bash
19+ run : |
20+ arch=$(uname -m)
21+ if [[ "$arch" == "x86_64" ]]; then
22+ DOWNLOAD_URL="https://github.com/gbraad-redhat/Machinefile/releases/download/0.2.0/linux-amd64.tar.gz"
23+ elif [[ "$arch" == "aarch64" ]]; then
24+ DOWNLOAD_URL="https://github.com/gbraad-redhat/Machinefile/releases/download/0.2.0/linux-arm64.tar.gz"
25+ else
26+ echo "::error::Unsupported architecture: $arch. Only x86_64 and aarch64 are supported."
27+ exit 1
28+ fi
29+
30+ echo "Downloading Machinefile executor from $DOWNLOAD_URL"
31+ mkdir -p /tmp/machinefile-executor
32+ curl -sSL $DOWNLOAD_URL | tar -xz -C /tmp/machinefile-executor --strip-components=1
33+ chmod +x /tmp/machinefile-executor/machinefile
34+ echo "Downloaded and extracted Machinefile executor binary"
35+
36+ - name : Execute Containerfile commands
37+ shell : bash
38+ run : |
39+ echo "Running Containerfile: ${{ inputs.dockerfile }}"
40+ echo "Context directory: ${{ inputs.context }}"
41+ sudo /tmp/machinefile-executor/machinefile "${{ inputs.containerfile }}" "${{ inputs.context }}"
You can’t perform that action at this time.
0 commit comments