Skip to content

Commit 9ce85e3

Browse files
authored
support macos (#2)
* Sync from khs1994-docker/lnmp@4e95acb by PCIT * Sync from khs1994-docker/lnmp@26af30b by PCIT * Sync from khs1994-docker/lnmp@b6db46f by PCIT * Sync from khs1994-docker/lnmp@95b65e6 by PCIT * Sync from khs1994-docker/lnmp@fa1feec by PCIT
1 parent 9a3e6d7 commit 9ce85e3

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ jobs:
2424
- ubuntu-20.04
2525
- ubuntu-latest
2626
include:
27+
# macOS
2728
- os: macos-latest
2829
docker_channel: stable
2930
docker_version: 19.03
31+
- os: macos-latest
32+
docker_channel: edge
33+
docker_version: 19.03
3034
runs-on: ${{ matrix.os }}
3135
steps:
3236
- uses: actions/checkout@main
@@ -42,7 +46,8 @@ jobs:
4246
run: |
4347
set -x
4448
docker version
45-
cat /etc/docker/daemon.json
49+
cat /etc/docker/daemon.json || true
50+
cat /Users/runner/.docker/daemon.json || true
4651
docker buildx version || true
4752
docker buildx ls || true
4853
@@ -65,7 +70,7 @@ jobs:
6570
- uses: docker/login-action@v1
6671
if: |
6772
github.event_name == 'push'
68-
&& startsWith( ${{ matrix.os }}, 'ubuntu' )
73+
&& startsWith( matrix.os, 'ubuntu')
6974
with:
7075
# registry: contoso.azurecr.io
7176
username: ${{ secrets.DOCKER_USERNAME }}
@@ -79,9 +84,9 @@ jobs:
7984
echo ${docker_password} | docker login -u ${docker_username} --password-stdin ${docker_registry:-}
8085
if: |
8186
github.event_name == 'push'
82-
&& startsWith( ${{ matrix.os }}, 'macos' )
87+
&& startsWith( matrix.os , 'macos' )
8388
env:
84-
docker_registry: contoso.azurecr.io
89+
# docker_registry: contoso.azurecr.io
8590
docker_username: ${{ secrets.DOCKER_USERNAME }}
8691
docker_password: ${{ secrets.DOCKER_PASSWORD }}
8792
- name: Build Docker Image

lib/setup-docker.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async function buildx() {
4848
'version',
4949
]).then(async () => {
5050
// install buildx
51-
core.startGroup('install buildx');
51+
core.startGroup('setup qemu');
5252
await exec.exec('docker', [
5353
'run',
5454
'--rm',
@@ -62,7 +62,7 @@ async function buildx() {
6262
core.startGroup('list /proc/sys/fs/binfmt_misc');
6363
await exec.exec('ls -la', [
6464
'/proc/sys/fs/binfmt_misc',
65-
]);
65+
]).catch(() => { });
6666
core.endGroup();
6767

6868
core.startGroup('create buildx instance');
@@ -94,15 +94,15 @@ async function buildx() {
9494
async function run() {
9595
const platform = os.platform();
9696

97-
if (platform === 'windows') {
97+
if (platform === 'win32') {
9898
core.debug('check platform');
9999
await exec.exec('echo',
100100
[`Only Support Linux and macOS platform, this platform is ${os.platform()}`]);
101101

102102
return
103103
}
104104

105-
if (platform !== 'linux') {
105+
if (platform === 'darwin') {
106106
// macos
107107
await exec.exec('docker', [
108108
'--version']).catch(() => { });
@@ -114,20 +114,20 @@ async function run() {
114114
await exec.exec('brew', [
115115
'cask',
116116
'install',
117-
'docker'
117+
DOCKER_CHANNEL !== 'stable' ? 'docker-edge' : 'docker'
118118
]);
119119
core.endGroup();
120120

121121
await exec.exec('mkdir', [
122122
'-p',
123-
'/home/runner/.docker'
123+
'/Users/runner/.docker'
124124
]);
125125

126-
await shell(`echo '${DOCKER_DAEMON_JSON}' | sudo tee /home/runner/.docker/daemon.json`);
126+
await shell(`echo '${DOCKER_DAEMON_JSON}' | sudo tee /Users/runner/.docker/daemon.json`);
127127

128128
core.startGroup('show daemon json content');
129129
await exec.exec('cat', [
130-
'/home/runner/.docker/daemon.json',
130+
'/Users/runner/.docker/daemon.json',
131131
]);
132132
core.endGroup();
133133

0 commit comments

Comments
 (0)